search the stringlist for a given element

Here is my requirement. Is there any eixsing FS that I can use or I need to write one:

Given an element to search, this flow service should search through the elements of the array and should return
true if exists in the array else should return false.

Input:
elementToSearch
Array containing elements (arrayToSearch)

output:
true if “elementToSearch” is in “arrayToSearch” else return false.

Sudheshna,

You can try with this WmEDI service (wm.b2b.edi.util:nodeExists) it returns true or false. for element search…if your requirement looking for this.

HTH,
RMG

Hi Sudheshna,
Is you requirement something like this:

you have a stringList e.g. nameList with values nameList[0]=“Bhawesh”; nameList[1]=“Sudheshna” etc… and you want to know if there is a IS built-in service which you can supply the nameList and the search string “Sudheshna” and it should tell you whether “Sudheshna” appears in the Array nameList or not?

Well there is no built-in service but you can write a small flow service like this:

call pub.string:makeString and supply the nameList.
call pub.string:indexOf and map value to inString and supply Sudheshna in the subString.

If the output if pub.string:indexOf is -1, then Sudheshna doesn’t appear in the array nameList else it apears one or more times.

HTH,
Bhawesh

1 Like