Hi all,
Is there a way to combine an 'Or' into the 'IIf' expression under Item Types.
I am trying to analyze the level name of an element and then return simple text based on whether it finds specific text within the level name for a number of different strings of text.
eg:
IIf (System.String.Contains (This.GetElement().Level, "TextString1"), "TextString1", "NA") Or IIf (System.String.Contains (This.GetElement().Level, "TextString2"), "TextString2", "NA") etcetera
'Or' is there a btter way of doing it please?
Thanks in advance,
How about below expression ?
IIF(System.String.Contains(this.GetElement().Level, "Plan Border") || System.String.Contains(this.GetElement().Level, "Plan Text Title") , this.GetElement().Level, "NA")
Apologies for the delay, it gets me very close however the above returns the full text of the level name. Is there a way to replace with pre-chosen text like:
IIF(System.String.Contains(this.GetElement().Level, "TEXT1"), "REPLACEMENTLEVELTEXT1" || System.String.Contains(this.GetElement().Level, "TEXT2"), "REPLACEMENTLEVELTEXT2" , this.GetElement().Level, "NA")
The clause System.String.Contains(this.GetElement().Level, "TEXT1") compares the level name with predefined text TEXT1.
System.String.Contains(this.GetElement().Level, "TEXT1")
TEXT1
The clause System.String.Contains(this.GetElement().Level, "TEXT2") compares the level name with predefined text TEXT2.
System.String.Contains(this.GetElement().Level, "TEXT2")
TEXT2
Those clauses are embraced by the Iif statement which selects either this.GetElement().Level or NA. Try substituting your text for that final this.GetElement().Level.
Iif
this.GetElement().Level
NA
Regards, Jon Summers LA Solutions
Apologies Jon, I may be misunderstanding you but I am trying to get a return for each of the found text parts.
So if it finds text1, replace with text1a, if it finds text2 replace with text2a, or failing to find any matches replace with NA.
Regards,
How about this?IIF(System.String.Contains(this.GetElement().Level, "TEXT1"), "REPLACEMENTLEVELTEXT1",IIF(System.String.Contains(this.GetElement().Level, "TEXT2"), "REPLACEMENTLEVELTEXT2", "NA"))
Answer Verified By: Ted Gabriel