Page 1 of 1

many Records on look-up

Posted: Sat Apr 04, 2015 11:41 pm
by sbigelow
I'm trying to create a lookup form where the records are filtered if the field sysuser_id = the current user. Or if the globeadmin is running the report. For some reason I can only get one of the conditions to work. If I use the SQL below the look-up works fine for the globeadmin but when the user logs in it will filter the look-up properly but when I select a "Company" it fills in the text "many records" on the form.

Code: Select all

SELECT * FROM company WHERE sysuser_id = '#nu_user_id#' OR 'globeadmin' = '#nu_access_level#';
Any ideas how I can do this so it is filtered for user but the globeadmin can see everything?

Re: many Records on look-up

Posted: Tue Apr 07, 2015 1:25 am
by admin
sbigelow,

You need brackets around you where clause.

Code: Select all

SELECT * FROM company WHERE (sysuser_id = '#nu_user_id#' OR 'globeadmin' = '#nu_access_level#');
Because nuBuilder may add extra stuff on the end if you are using the search.

Code: Select all

SELECT * FROM company WHERE sysuser_id = '#nu_user_id#' OR 'globeadmin' = '#nu_access_level#' OR something else;
Could give you a weird result.

Steven

Re: many Records on look-up

Posted: Tue Apr 07, 2015 1:50 am
by sbigelow
You are right. Thanks! That fixed it.

Re: many Records on look-up

Posted: Tue Apr 14, 2015 1:22 am
by admin
.