gentercz
27th June 2007, 12:44
Hi all,

we are restricting some form fields by setting
logname$="anna" or logname$="xiaoling" or logname$="ashley"
in the Input Expression of special form fields.

Now this field is rather small for input.
So we can only specify upto 3 Users.

Idea was to do something like this:
logname$="anna" or "xiaoling" or "ashley" - BUT this is a syntax error.
Also "IN" clause, like in SQL is not working either.

ANY BETTER SUGGESTIONS ???

We do not want to modify the source.

Every answer is appreciated,
jochen

george7a
27th June 2007, 12:58
Hi,

I think you can use the pos function and write the names of the users inside the first argument with "." for a separator, then check if logname$ is in that text. The syntax should be like this:

pos("anna.xiaoling.ashley.anyother",logname$)

I hope it helps

-George

gentercz
27th June 2007, 13:03
Hi George,

wow what a great solution.
It works.

Thanks very much !!!
Jochen

bigjack
27th June 2007, 19:18
George - that is indeed a cool solution :cool:

Jochen - A word of caution (this approach will fail if logname$ is a subset of the specified user names for e.g. logname$ - "john" and list of allowed names is johnson , it will allow john to access the field)

But george that is indeed out of box thinking :)

george7a
28th June 2007, 09:27
Hi,

Thanks guys!

Bigjack is right. However, we can improve the old code, but it really depends on the space we have. The following solution is still smaller than the one with "OR" and don't fail when there are subsets:

pos(".anna.xiaoling.ashley.anyother.","."&logname$&".")

- George