many Records on look-up

many Records on look-up

Postby sbigelow » Sun Apr 05, 2015 7:11 am

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?
sbigelow
 
Posts: 15
Joined: Mon Mar 23, 2015 5:09 pm

Re: many Records on look-up

Postby admin » Tue Apr 07, 2015 8:55 am

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
admin
Site Admin
 
Posts: 3132
Joined: Mon Jun 15, 2009 9:53 am

Re: many Records on look-up

Postby sbigelow » Tue Apr 07, 2015 9:20 am

You are right. Thanks! That fixed it.
sbigelow
 
Posts: 15
Joined: Mon Mar 23, 2015 5:09 pm

Re: many Records on look-up

Postby admin » Tue Apr 14, 2015 8:52 am

.
admin
Site Admin
 
Posts: 3132
Joined: Mon Jun 15, 2009 9:53 am


Return to General