Setting the APP_USER as a value to be passed to target page in APEX

和自甴很熟 提交于 2020-01-07 04:23:05

问题


I'm making a student management system on apex. The short of it is a place where lecturers and students can log on. Lecturers create assignments, assign them, mark them, take attendance, record issues ...... all that, and students log on to view their attendance and results.

Now when a student clicks the "My Results" link it navigates to the same page that a lecturer sees, though the select list where a student is selected to view the results of is hidden. The select list displays the students name and returns the id for that student, which also happens to be the user name for a student to log in.

So i want to pass the value of the app-user when a student clicks the link so that only their results are shown.

I've tried to set

these items
:P10_SELECT_STUDENT
with these values
#APP_USER#

which works but no the message "no data found" is shown.

Just for testing i've set that select list to be displayed for a student, and when the page loads it loads with the null value at the top of the list which is

display value
select a student
return value
-1

I've gone and manually set the value passed to be the id of the test student. works a treat, the data loads for that student!!

So does anyone know why the #APP_USSER# value im sending isnt being set in the listbox

Thanks in advance


回答1:


What you need is the session state of the APP_USER variable. In a query you would reference this with :APP_USER. When you need to pass on the value as a parameter for, for example, a link, you would use the substitution string notation &APP_USER. Much the same way you would refer any other variable/page item.

For example, setting up a button:

A good page to read up on Substitution strings: Application Builder Concepts

The hash-sign notation is commonly used for non-plsql-variables substitution, like the value of a column in report when passed through in a link,




回答2:


Zac,

If the users haven't authenticate themselves then the :APP_USER parameter is null. If the user authenticated via a SSO, or via DB credentials or whatever you have in the application then the :APP_USER will get populated.

Here is what i understood : In page 12 , P12_STUDENTS is a select list, and you want it to reflect the current student if he enters or the full list if he's a teacher right?

You don't need to pass :APP_USER via a link or a branch or whatever. It exists as a global Apex variable and is visible in page 12 via :APP_USER but again , its null if the user is not authenticated.

Your select list source should be like:

 select display d,  return r
  from table
  where (:APP_USER is NULL
        OR (:APP_USER IS NOT NULL AND :APP_USER = student))

tell me if this helps?

regards,

Alex



来源:https://stackoverflow.com/questions/8148247/setting-the-app-user-as-a-value-to-be-passed-to-target-page-in-apex

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!