Solved IF Statement in Blue Prism

What am I trying to do -
I have a string obtained from Regex and saved in a data item - this is a transaction reference
The first 2 or 3 characters determines the type of transactions.
I need to have an IF statement where the type of transaction to be determined and then store in one of the fields in a collection.
Options evaluated -
1. Choice Stage : I can use a choice state and provide all possible combinations, output will be transaction type stored in another data item.
2. Multi Calc Stage : I can use multi calc with all possible combinations, store result in another data item (flag), put decision box and obtain the transaction type
What I want -
I don't want to use more stages, such as Choice or Multi.
I need to use IF Statement and provide statements so that if the reference starts with CH or KY or FE then it will be called as Charges, else called as Financial, something like below.
IF(StartsWith([myRef], "CH") OR StartsWith([myRef], "KY") OR StartsWith([myRef], "FE"),"Charges","Financial")

But I am unable to find any way, please assist.
I am okay if a code stage will be required too, just suggest something.

Regards
El Guapo
 

sivagelli

Well-Known Member
If i followed your problem statement correct. You are trying to determine the kind of transaction based on the starting letters.

Let's store the value (either Charges or Financial) in to a Data Stage - Result of Type Text.

Use a Decision stage with Expression StartsWith([myRef], "CH") OR StartsWith([myRef], "KY") OR StartsWith([myRef], "FE"). To the YES path add a Calc stage and write "Charges" in to expression area and Store into Result . For the NO path, have a Calc stage and in the expression write "Financial" and Store into Result.

Hope this is what you are looking for.
 
  • Like
Reactions: VJR
Visiting back after few days.
Hi Sivagelli, thanks for response.
Ideal solution will be to use choice stage which I am going ahead with.

Alas, no way for an IF statement equivalent action.

Regards
El Guapo
 
Top