I am receiving a malformed if statement error with the below formula. Can you explain why this is and how can I correct?
IF IsNull([Base_Part_Cal_1])THEN [Corp Part Nbr] ELSEIF FindString("-",[Corp Part Nbr]>2) THEN Substring([Corp Part Nbr],1,FindString("-",[Corp Part Nbr]-1))ELSE Substring([Corp Part Nbr],FindString("-",[Corp Part Nbr])+1,Length([Corp Part Nbr]-FindString("-",[Corp Part Nbr])) ENDIF
Solved! Go to Solution.
Hi @raviraghava ,
In your first Find string formula, the closing bracket should exclude the ">2", whilst also the field name should come first.
So now you have typed
ELSEIF FindString("-",[Corp Part Nbr]>2)
when it should have been
ELSEIF FindString([Corp Part Nbr],"-") >2.
The same goes for all following Findstring calls. As shown in the following image, the field's name should precede the target
Hope that helps,
Angelos
@raviraghava
I tried to run your formula, asides the points from @AngelosPachis , there is one more missing in red think.
IF IsNull([Base_Part_Cal_1])THEN [Corp Part Nbr] ELSEIF FindString([Corp Part Nbr],"-")>2
THEN Substring([Corp Part Nbr],1,FindString([Corp Part Nbr],"-")-1)
ELSE Substring([Corp Part Nbr],FindString([Corp Part Nbr],"-")+1,Length([Corp Part Nbr])-FindString([Corp Part Nbr],"-"))
ENDIF
Hi @raviraghava , as suggested by @AngelosPachis and @Qiu there are some syntax errors in your
formula as mentioned in red below:
IF IsNull([Base_Part_Cal_1])THEN [Corp Part Nbr] ELSEIF FindString("-",[Corp Part Nbr]>2) THEN Substring([Corp Part Nbr],1,FindString("-",[Corp Part Nbr]-1))ELSE Substring([Corp Part Nbr],FindString("-",[Corp Part Nbr])+1,Length([Corp Part Nbr]-FindString("-",[Corp Part Nbr])) ENDIF
Corrected formula in green:
IF IsNull([Base_Part_Cal_1])THEN [Corp Part Nbr] ELSEIF FindString([Corp Part Nbr],"-")>2
THEN Substring([Corp Part Nbr],1,FindString([Corp Part Nbr],"-")-1)
ELSE Substring([Corp Part Nbr],FindString([Corp Part Nbr],"-")+1,Length([Corp Part Nbr])-FindString([Corp Part Nbr],"-"))
ENDIF
I hope this helps.
Thanks.
Thanks for your clarification. Appreciated
Thanks for your detailed explanation with screenshots. Appreciated
Thanks Sapna for your detailed explanation, its really helped me to find the root cause of my issue.