Conditional mapping using IF statement in webMethods.io

Hi ,

I want to check whether a certain variable CONTAINS some set of strings or not using IF condition in WebMethods.io. Based on the values, I want to execute my steps. Is this possible? If yes, please share the code snippet.

Ex:- Whether string1 starts with “ABC” or “DEF” or “GHI”. Based on this, I want to execute 3 different flow steps in my flow service. string1 contains alphanumeric values.

Thanks in advance.

I have not used webmethod.io but you mentioned you’re using FLOW steps…

Using BRANCH on ‘var’ you can use regex in the step labels to select the step/block you want execute for each:

BRANCH on '/myVar'
  /^ABC/ : SEQUENCE
  /^DEF/ : SEQUENCE
  /^GHI/ : SEQUENCE

If you want to ignore case, use /(?i)^ABC/

The / / around the label indicates the label contains a regular expression. We use that a lot.

Hello @atjha

webMethods.io Integration FlowServices do not yet support regular expressions.
As an alternate solution you could use the Substring utility to extract the first three characters from the string, and then use IF statements to determine if the substring value is equal.
Obviously the begin and end index used in the Substring can be whatever you need (e.g. make these dynamic).

For example

In the first step, the Substring is checking String1, using a beginindex of 0 and endIndex of 3.
The subStringValue is the first three characters of the string.
The rest of the code uses regular IF statements to check if subStringValue equals to the compare value (e.g. ABC, DEF, or GHI).
In the on-premise Flow Services world you can use regular expressions.

Do you always want to check which characters are at the beginning? Of course you can make the begin index and end index used in the Substring dynamic using parameters.
Anyway, this is a quick and dirty way. I am checking with our R&D team about when wM.io Integration FlowServices will support regular expressons.

Regards
Wayne

1 Like

Hi Wayne,

Thanks for providing the workaround. I would like to add some point, if I may. I don’t see much flexibility in terms of options available in WebMethods.io with Flow Services like we used to have with on-premise IS. Also, built in services are very less (to say the least).

Hope to see them in future though. :slight_smile:

Also, are there any built in services in WebMethods.io to handle incoming SOAP Requests? Please let me know.