This topic is locked

How to use a SESSION variable to define lookup

2/14/2012 12:54:04 AM
PHPRunner General questions
B
bussb author

I have a database shared by multiple organizations. In the user table, each user is associated to their organization with a integer Org_ID. Based on who is logged in, I would like to filter a lookup table to only display choices by organization. For example, Org_ID 1000 is an engineering firm, Org_ID 2000 is a legal firm. The lookup table holds position titles:
Org_ID Title

1000 Engineer

1000 Manager

1000 Chief Technology Officer

2000 Associate

2000 Legal Administrator

2000 Lead Council

2000 Investigator

2000 Document Processor
When a user from the engineering firm logs in, I create a SESSION variable storing their Org_ID as 1000. If a user from the legal firm logs in, the session variable holds the value of 2000.
How can I use the session variable as part of my query statement to create a lookup table that only has options specific to what type of user is logged in?

C
cgphp 2/14/2012

You can sort a lookup table using the WHERE expression. Check this article: http://xlinesoft.com/phprunner/docs/lookup_wizard.htm

lefty 2/14/2012



I have a database shared by multiple organizations. In the user table, each user is associated to their organization with a integer Org_ID. Based on who is logged in, I would like to filter a lookup table to only display choices by organization. For example, Org_ID 1000 is an engineering firm, Org_ID 2000 is a legal firm. The lookup table holds position titles:
Org_ID Title

1000 Engineer

1000 Manager

1000 Chief Technology Officer

2000 Associate

2000 Legal Administrator

2000 Lead Council

2000 Investigator

2000 Document Processor
When a user from the engineering firm logs in, I create a SESSION variable storing their Org_ID as 1000. If a user from the legal firm logs in, the session variable holds the value of 2000.
How can I use the session variable as part of my query statement to create a lookup table that only has options specific to what type of user is logged in?


It seems you already have a session value setup in before process event to grab session variable to Org_ID . Now in the lookup table in the option where clause enter the below code . This should grab when the user logs in and goes to this table he should only see Org_ID where he is setup in the users table for ex. Org_ID = 1000. If the session variable you setup has him as this then in the lookup table with the where statement he will only see the records from another table that you setup as a field in that table called Org_ID and field 1000.
Use Where statement in lookup table ; something like this

"Org_ID =" .$ _Session["Org_ID"]