NetTalk Central

NetTalk Web Server => Web Server - Ask For Help => Topic started by: ianburgess on June 05, 2012, 12:39:12 AM

Title: Help with filter syntax
Post by: ianburgess on June 05, 2012, 12:39:12 AM
I have a drop list on a form which has the following filter which works fine:

'A_USE:Active = ' & True & ' AND A_USE:Administrator <> ' & 2

I  need to add to the filter so that to pass, A_USE:Administrator must not be equal to 2 (as before) and either A_USE:Active is True OR the form is being "changed", but I cannot find how to test for the form being changed or syntax as to how to insert the test into the filter expression?

Anyone's help would be greatly appreciated.

Ian
Title: Re: Help with filter syntax
Post by: Niels Larsen on June 05, 2012, 01:16:34 AM
Like this

'A_USE:Active = ''1'' AND A_USE:Administrator <> ''2'''

or like this

p_web.GSV('A_USE:Active') & '= ''2'' AND ' & p_web.GSV('A_USE:Administrator') & ' <> ''2'''

/Niels
Title: Re: Help with filter syntax
Post by: Bruce on June 05, 2012, 01:42:16 AM
>> I cannot find how to test for the form being changed or syntax as to how to insert the test into the filter expression?

Choose(loc:act = Net:ChangeRecord,'1','A_USE:Active = 1') & ' AND A_USE:Administrator <> 2'

cheers
Bruce

Title: Re: Help with filter syntax
Post by: ianburgess on June 05, 2012, 01:53:07 AM
Thanks Bruce, I will give that a try. Are you saying that you cannot use OR in the expression but must use CHOOSE instead?

What if you wanted more than two ORs, eg. expression1 OR expression2 OR expression3 ?

Thanks

Ian
Title: Re: Help with filter syntax
Post by: Bruce on June 05, 2012, 03:49:05 AM
no, not at all.

In your case you didn't really have an OR clause, because the "form is in change mode" is really not related to the data. So in your case it wasn't necessary to make that part of the filter, but rather decide if it should be in the filter or not.

Because your one clause was going to be either true, or false, if it was embedded in the filter your filter would look something like;

'(A_USE:Active = ''1'' or true) AND A_USE:Administrator <> ''2'''
which is obviously the same as
'1 AND A_USE:Administrator <> ''2'''
which is the same as
'A_USE:Administrator <> ''2'''

or, if the form was not in change mode then
'(A_USE:Active = ''1'' or false) AND A_USE:Administrator <> ''2'''
which is the same as
'A_USE:Active = ''1'' AND A_USE:Administrator <> ''2'''

Cheers
Bruce