Relational operator 'contains'

I am working on an APICA script, for which I need to use a ‘Contains’ type realtional operator.


If (String1.contains(String2)) Then
Do This
Do This.

I have gone through the “Prx BASIC” Language manual, and could not find any operator that can be used for the above example.

Is there a way to handle the above scenario using a different operator.

Solved using Expected = “document.getElementById(‘dataForm:locationempty’)”
PRINT Expected

a= strIndexOf(TaskQuantityResponse,Expected)
print a

if(a>0) THEN
LcnEmptyLoop= 1
print LcnEmptyLoop
LcnEmptyLoop= 0
print LcnEmptyLoop

Hello @abhattacharyya, glad to see you found a solution and posted it here :slight_smile:

An alternative way to do conditional paths in a test is to make use of inner loops,

Depending on your endgame this might also be of assistance

@daniel Thanks for the reply. You have made a habit out of helping me out, and thanks for that. :slight_smile:

I actually needed the extracted value to be used as condition for my inner loop (I am actually seeing if a specific value exists in a page html, if the value exists, I extract it in a variable, and if it does not, I extract a different value in a second variable)

Hey @abhattacharyya !

There is actually a function in PrxBasic that works like what you are describing: strContains.

It checks whether the exact String2 appears in the current String1 or not. You can use it like this:

If (strContains(String1,String2)) Then
Do This
Do This.

Happy Scripting! :smiley:

Thanks @Calle , that is a much simpler, and elegant solution, instead of having to use index values.

Can you point me to some documentation of this, as I could not find it in the PrxBasic documentation in APICA Academy.


You can find these commands by pressing CTRL + SPACEBAR while you’re writing your code. You will get a list of available commands to choose from, with a short description on how to use it. If you require more specific information it is hopefully described in the PrxBasicLanguageReferenceManualEn manual, located in the Documentation folder inside your ZebraTester installation.

1 Like