Advanced Query Where Clause Boolean Logic

Hi All,

I'm struggeling with this query, please see attachment.

I'm trying to limit the Members being returned by the GroupId input parameter except where the Administrator privilege is assigned to the user. (This is different than the Administrator Role).

I'm getting the following error: Error in advanced query GetLeads: An expression of non-boolean type specified in a context where a condition is expected, near ')'.

Thanks and Regards,
The SQL is not correct - refer underlined. Your evaluative statement after the 'or' is incomplete.

AND ({MemberGRoup}.[GroupId] = @GroupId or @isAdministrator)

I would suggest whilst trying to develop your queries then do it outside of the OS environment. This way it is much faster and then when your query is ok then post it back and modify to suit the OS format.

Good luck!
Hi Mark,

Thanks for the reply!

As far as I know, this is perfectly valid in SQL:

AND (({MemberGroup}.[GroupId] = @GroupId) OR (@isAdministrator = True))

isAdministrator is a Boolean, so it shouldn't be necessary for me to specify the = True part.

Trying to execute this basic query also results in an error:
IF (@isAdministrator = True)
    SELECT {Member}.*
    FROM {Member}

Error in advanced query GetLeads: Invalid column name 'True'.

Any additional pointers? :)

Kind Regards,