recently I came across a requirement that was to test if a value was in list where the list was in a variable. The variable, [list] = “123;234;456;1114678;768;999111“, I I need to test if the value of a certain dimension , [numero], was in the list [list]. As you know, the InlList operator can be used only with a literal list (that´s it a text, like “123;234;456;1114678;768;999111”, not in a variable. Then testing for [numero] InList([test]) will throw an error.
To overcome this situation, one can test for the Pos of [test] in [list], if the result is >0, [numero] is present in [list]. The downside is when [numero] is contained in another value for instance , “111” is not part of the list, but is contained in “1114678”. To parcialy overcome this issue, you can test for “;”+[numero] and [numero]+”;”. So my formula will be :
If( (Pos([list];”;”+[numero)>0)or (Pos([list];[numero]+”;”)>0);”InList”;”NotInList”)