Welcome to the nuBuilder forums!

Please register and login to view forums and other content only available to registered users.

many Records on look-up

Locked
sbigelow
Posts: 15
Joined: Mon Mar 23, 2015 8:39 am

many Records on look-up

Unread post 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?
admin
Site Admin
Posts: 2781
Joined: Mon Jun 15, 2009 2:23 am
nuBuilder Version: 4.5
Been thanked: 1 time

Re: many Records on look-up

Unread post 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
sbigelow
Posts: 15
Joined: Mon Mar 23, 2015 8:39 am

Re: many Records on look-up

Unread post by sbigelow »

You are right. Thanks! That fixed it.
admin
Site Admin
Posts: 2781
Joined: Mon Jun 15, 2009 2:23 am
nuBuilder Version: 4.5
Been thanked: 1 time

Re: many Records on look-up

Unread post by admin »

.
Locked