Hi, Can someone help me with my if statement below? thank you!
IF ISNULL([_CurrentField_])
THEN [_CurrentField_]
ELSEIF REGEX_Match([_CurrentField_],"[A-Z]*")
THEN "CONTAINS([" + tostring([Filter 1])+'],"' + tostring([_CurrentField_]) + '")'"
ELSE "aa"
ENDIF
Solved! Go to Solution.
@Lichunhuang, in the second THEN you should not use doube quotes before CONTAiNS formula.
Also, the use of CONTAins seems inappropriate as it will return boolean TRUE or False and then you are adding that with Current_Field.
Regards,
Shreyansh
Hi @Lichunhuang
If I understand correctly your quotes are out of order in the last part of your then clause: + '")'"
Try this: + '")"'
Looks like you have problem with the last clause :
THEN CONTAINS([_CurrentField_],"'[' + tostring([Filter 1])+']',tostring([_CurrentField_]))
Could you Explain what you want to do with this condition
I changed with "test" and it works
IF ISNULL([_CurrentField_])
THEN [_CurrentField_]
ELSEIF REGEX_Match([_CurrentField_],"[A-Z]*")
THEN "test"
ELSE "aa"
ENDIF
Regards,
Hi, the second one is a string, but not a formula. The final text looks like this: CONTAINS([GC],"BC") That is why I put quotes.
Hi @Lichunhuang
Can you provide some sample input and expected output it will help us get a better understanding of the usecase.
THEN "CONTAINS([" + tostring([Filter 1])+'],"' + tostring([_CurrentField_]) + ")"
For this part , it works well in my workflow, but when I add REGEX_Match([_CurrentField_],"[A-Z]*") , It shows something wrong. I guess this is the part causing the problem.
Hi @Lichunhuang
Change REGEX_Match([_CurrentField_],"[A-Z]*") to REGEX_Match(tostring([_CurrentField_]),"[A-Z]*")
adding tostring
Hope this helps : )
Remove the last double quotes n the second THEN clause. Works good.
THEN "CONTAINS([" + tostring([Filter 1])+'],"' + tostring([_CurrentField_]) + '")'.
Hi @Lichunhuang
I am pretty certain it is the ordering of your single and double quotes in the then statement. I tweaked it to this and it works. See my above post for the issue.
IF ISNULL([_CurrentField_])
THEN [_CurrentField_]
ELSEIF REGEX_Match([_CurrentField_],"[A-Z]*")
THEN "CONTAINS([" + tostring([Filter 1])+'],"' + tostring([_CurrentField_]) + "')'"
ELSE "aa"
ENDIF