Syntax of expression in Workflow
Hi
I'm trying to select values from a dropdown list generated by a ComboBox in a workflow. The dropdown list works fine with all unique occurences of the field listed. However, when the user selects 'C' from the list the workflow also selects 'CH', 'CO' etc. I suspect the problem is in the expression in the Setup WHERE clause in the workflow, under Assign. This is the current expression:
if(String.IsNullOrEmpty(Code.tostring), where, if(String.IsNullOrEmpty(where), "Code LIKE '" + Code.tostring + "%'", where + " AND Code LIKE '" + Code.tostring + "%'"))
I've tried changing the LIKE to an equals but then no results are returned. Is anybody able to help with the syntax in this expression?
Thanks
David Tonkin
0
-
String.Format("Code = '{0}'",Code)0 -
Nico's got the way to go, but FYI you can also overload the if operator with two args which essentially makes the first arg a nullable value with the second arg acting as a default: "Code = '"+if( Code, CObj("") ).toString+"'"0 -
Thanks Zack, that's what I normally use in stead of the String.Format variant :-), except I use just "" in stead of CObj(""). 0 -
Depending on the class of Code, of course! If we can infer a string value from the arguments, then the .toString method is superfluous anyway. 0 -
Great! Thanks Nico and Zack. It works perfectly now using Nico's suggestion. 0
Du måste logga in om du vill lämna en kommentar.
Kommentarer
5 kommentarer