This was kind of interesting to figure out. What I was going after is the following. I had a drop down box on a page that shows some Business Units. The values however need to be dynamic and change depending on the user viewing/accessing the page.
For example, user1 should only see 52024, 12456 but user2 should be allowed to see 52024, 12456, 45648, and 10235.
To accomplish this I’ve created a table to store values for each user (lets call it TABLE_1). TABLE_1 has 2 fields (oprid, and business_unit). So now, we have 2 users on the table along with their associated business units.
The 2nd step is to create the dynamic view to pull business units specific to each user. The view will only have one field and that is the business_unit field.
On the Record Type tab choose Dynamic View and click “Click to open SQL Editor” to add your SQL view.
Your SQL will look something like this:
SELECT
business_unit
,oprid
FROM
(
SELECT
business_unit
,oprid
FROM
TABLE_1
)
WHERE
%oprclause
The %oprclause is what drives the dynamic view. At run time if the OPRID is in the view, %oprclause expands to OPRID=’current operator’ and therefore the view will only show values that are specific to the user viewing the page!
转载于:https://www.cnblogs.com/GoDevil/archive/2008/08/11/1265258.html