Substring variable in conditional gateway

I wish to know how I can use a substring in a conditional gateway (XOR).
I have a variable type string and in my condition I wish to set if the first two characters of the variable are equals to a specific value or not.
How can I solve it?


@glonico you can try like this suggestion:

<conditionExpression xsi:type="tFormalExpression">
  <![CDATA[${"Stephen Hawking".substring(4)}]]>
1 Like

@aravindhrs I don’t understand. If I use this expression I have the value of the first 3 characters, but I haven’t compare with the specific value that I want considered.
For example…I have a variable called PROVA its value is 1234567, and I want to verify if the first to characters are equals to 89.
So if I use the expression I know the value that is 12, but I don’t know if it’s equal or different by my specific value.
I wish to know how to compare the substring with the specific value.


<conditionExpression xsi:type="tFormalExpression">
  <![CDATA[${("Stephen Hawking".substring(4)).equals("someValue")}]]>
1 Like

@aravindhrs I can’t get it to work.
I expect that the expression return an equality, but this does not happen.
I attached a screen with the expression config
I’m probably wrong, but I don’t understand what.

If is a attribute of object then remove the surrounding quotes

@aravindhrs is a variable and contains the value of a telephone number that start with 32 (es. 329XXXXXXX)
In every case the expression not work with quotes and even without.

Upload your BPMN model. I will check and update you

Ok, here there’s the file .bpmn
prova_substring.bpmn (4.5 KB)

@glonico are you starting the process instance with variable “” ?

Then set asynchronous continuations flag as camunda:asyncBefore=“true” at the Exclusive gateway like below:

@aravindhrs The variable exists when I start the process.
I check the value Asynchronous Before (= true) but don’t work.
I try it with quotes in expression and even without.

@glonico, can you provide the payload you used for starting process instance?