Lookup of "select" field in Grid Application

I have a Grid application. in the search I want to restrict the rows that get loaded into the “search lookup” by another variable (usernumber) but can’t quite figure out how to do it.

In Search/OnInit I have this code


{personid2} = $_SESSION['g_id_user'];
echo {personid2};

This does echo the value of {personid2} which is for example 12.

Now in my Search, Fields, Phone field, I have an automatic lookup for my “select” data type.

select phone
from phones
where personid = {personid2}

When I run my application it doesn’t return any rows in the Phone field. It should list all the phone numbers for just the one person that I am logged into.

Not sure what I’m doing wrong.

Re: Lookup of “select” field in Grid Application

active application in debug mode and check the contents of personid2 in the where clause

Try adding single quotes
where person = '{personid2}

lucky

Re: Lookup of “select” field in Grid Application

If I display the field in the search, it all works, but I don’t want to display it. I want to hide it, but there is no way to hide it, even by using sc_display_field.

Re: Lookup of “select” field in Grid Application

im not sure if it’s just a typo here, but the function to hide a field is sc_field_display({field},on/off); and you put either on or off depending on what you want to do.

Re: Lookup of “select” field in Grid Application

Vivid,
Yes it was a typo.

I ended up using a Control Form Application instead of the built in Search portion of the Grid, and it looks like it’s working pretty well.

In my case even though I’m having the user fill in the information to do the search, I’m actually creating the “where” clause so I didn’t need all the built in features of the Search.

I need to do similar. Can you please share more details on how did you do it ?
Art