Wwctx_api.get_user in Dynamic Page?
Can API calls be made from select statements within the <ORACLE></ORACLE> tags in Dynamic Pages? The following query should list courses that someone has signed up for but the query cannot be saved within the Dynamic Page:
<ORACLE>
select course_name
from course
where user_id = wwctx_api.get_user
</ORACLE>
Regards,
Jay
Jay Mason
Director, Oracle Web Applications Development
Effective Shareholder Solutions, Inc.
Jay,
Just prefix the function with "PORTAL30" (or the name of the schema where Portal is installed, if not PORTAL30).
<ORACLE>
select course_name
from course
where user_id = PORTAL30.wwctx_api.get_user
</ORACLE>
null
Similar Messages
-
Using wwctx_api.get_user in dbms_rls policy
We have not been able to succesfully use a call to wwctx_api.get_user in the function we use as a policy for row level security. The package compiles fine. The policy adds fine. When we try to select from the table where the policy is on from portal (LOV, REPORT, DYNAMIC PAGE) we get Ora-28112.
Help?The error code maps to the following message:
ORA-28112 failed to execute policy function
Cause: The policy function has one or more error during execution.
Action: Check the trace file and correct the errors.
Could you try returning a static value from the security policy and do your select and see if that works. -
In a dynamic page how to share variable between PL/SQL and javascript
For example, my dynamic page contains such PL/SQL codes:
<ORACLE>
DECLARE
info varchar(100);
rowid urowid;
procedure doDelete(
row_id in urowid
) IS
begin
Delete From xxx
WHERE rowid = row_id;
end doDelete;
BEGIN
Select name, rowid INTO info, rowid
From xxx Where xxx;
HTP.PRN(' <INPUT TYPE="button" VALUE="show value" onClick="alert(info);">');
HTP.PRN(' <INPUT TYPE="button" VALUE="delete" onClick="doDelete(_row_id);">');
END;
</ORACLE>
The variable 'info' and '_row_id' are correct, however the two HTP. sentence do not work. What's the problem?
What I want to do is to show all the records in TABLE A in a page. And at the end of each line (record), there' re a 'delete' and a 'update' button to let user operate on this record. Is this possible? I know form can do delete an update, but it can not show all the records in a page like what report does. Besides dynamic page, is there any other better choice? Report can do it?
One more question. In a report, I employed link on one field to a second report. It works well. But I want to open the second report in a new window when the link is click. Is this possible?
I was almost driven crazy by these :( I so appreciate if anyone can help.The code written by you is insufficient for the funtionality you are trying to achieve. Below is a method to achieve the same.
Note: Used standard scott.emp table for the example which is located in my db provider schema.
Do the below modifications as per your local configuration
xxxxx -> Replace it with your Portal schema
yyyyy -> Replace it with your db provider schema
<<module_id_of_form>> -> Replace with the module id of form created in step 1 & 2.
First and foremost... oracle does not allows variables starting with '_'. So if you want to use it you have to place it in double quotes ("")
rowid -> illegal
"_row_id" -> legal.
However, I will advice you not to use variable names starting with "_".
Now lets get started...
1. Create a form on the table you are using in the dynamic page. Just have the update button. Remove the other buttons.
2. Get the module id of this form. Instruction for getting the module id:
a) Right-click on the form's run link and copy the shortcut
b) Get the value of p_moduleid parameter. This is your module id.
3. Create a procedure "save_action_details" in your db provider schema. This procedure will accomplish the delete operation on the record.
CREATE OR REPLACE Procedure save_action_details(
p_rowid IN VARCHAR2,
p_action IN VARCHAR2,
p_dyn_ref_path IN VARCHAR2,
p_dyn_page_url IN VARCHAR2)
is
l_sto_session xxxxx.wwsto_api_session;
begin
l_sto_session := xxxxx.wwsto_api_session.load_session(
p_domain => 'DynStore',
p_sub_domain => 'DynStore_' || p_dyn_ref_path
l_sto_session.set_attribute(
p_name => 'rowid',
p_value => p_rowid
l_sto_session.set_attribute(
p_name => 'action',
p_value => p_action
l_sto_session.save_session;
htp.init;
owa_util.redirect_url(p_dyn_page_url);
end save_action_details;
Explaination: The above procedure creates a session and keeps the rowid and action in the session. This information is used by the below dynamic form to perform the necessary action. In our exampl, the action is always going to be delete so you may go ahead and hard code it, else leave it as it is.
4. Grant execute privilege on the procedure "save_action_details" to public.
sql> grant execute on save_action_details to public;
5. Create your Dynamic page.
a) In HTML code section have the below code. This code shows some columns from the table and "update" and "delete" buttons to perform the respective action.
<ORACLE>select empno,ename,rowid,
'<input type="button" value="Update" onClick="doAction(this.form,''UPD'',''xxx'','''
|| xxxxx.wwv_standard_util.url_encode(rowid) || '''); tWin();">
<input type="button" value="delete" onclick="doAction(this.form,''DEL'',''' || rowid || ''',''xxx'');">' Action
from yyyyy.emp</ORACLE>
b) In additional pl/sql code section of dynamic page, have the below pl/sql block "in after displaying the header" section.
declare
l_sto_session xxxxx.wwsto_api_session;
l_del_rowid varchar2(20);
l_action varchar2(10);
begin
htp.comment('User code starts here ...');
htp.p('<script>');
htp.p('var winHandle;');
htp.p('
function doAction(formObj, action, rowid, erowid)
if (action == "UPD")
var formURL = "' || xxxxx.wwctx_api.get_proc_path('wwa_app_module.link?p_arg_names=_moduleid&p_arg_values=<<module_id_of_form>>&p_arg_names=_rowid&p_arg_values=') || '" + erowid;
winHandle = window.open(formURL, "winDynUpd", "width=750,height=500,resizable=yes");
else
formObj.p_rowid.value = rowid;
formObj.p_action.value = action;
formObj.submit();
function tWin() {
if (winHandle.closed) {
document.location = document.location;
else {
setTimeout("tWin()", 500);
htp.p('</script>');
htp.p('<form name="dynRowProcess" method="POST" action="'
|| xxxxx.wwctx_api.get_proc_path('save_action_details','yyyyy')
|| '">');
htp.p('<input type="hidden" name="p_rowid">');
htp.p('<input type="hidden" name="p_action">');
htp.p('<input type="hidden" name="p_dyn_ref_path" value="' || p_reference_path || '">');
htp.p('<input type="hidden" name="p_dyn_page_url" value="' || p_page_url || '">');
l_sto_session := xxxxx.wwsto_api_session.load_session(
p_domain => 'DynStore',
p_sub_domain => 'DynStore_' || p_reference_path
l_del_rowid := l_sto_session.get_attribute_as_varchar2('rowid');
l_action := l_sto_session.get_attribute_as_varchar2('action');
if l_action = 'DEL' then
delete from yyyyy.emp
where rowid = l_del_rowid;
end if;
end;
Explaination: The session information (rowid and action) stored by "save_action_details" procedure is retrieved by the dynamic page and is used to delete the record.
6. Once you are through with the above steps, test it by placing the above "dynamic page" portlet on a page.
a) When you click on delete button the record gets deleted and the automatically refreshed page will not show the deleted record.
b) On clicking update button, a form will appear. do the necessary modifications in data and click update. the data in the form gets updated. Once you close the form the dynamic page gets refreshed automatically and it will show you the updated information. -
ORACLE tags in Templates vs Dynamic Pages
Hello all,
I have a procedure that prints the Portal version:
Create or Replace PROCEDURE MATSTESTSCHEMA.SHOW_PORTAL_VERSION
as
l_ver varchar2(20);
BEGIN
l_ver := portal30.wwctx_api.get_product_version();
htp.print(l_ver);
END;
I can call this procedure successfully from a Dynamic Page with
the following embedded syntax in the HTML code:
<ORACLE>
BEGIN
MATSTESTSCHEMA.SHOW_PORTAL_VERSION;
END;
</ORACLE>
I want to use some procedure calls in my templates as well.
Tried to use the same syntax as above but it does NOT work.
The whole code block between the <ORACLE>-tags seems to be
ignored as soon as a procedure call is included.
A simple syntax like this DOES work in a template:
<ORACLE>
BEGIN
htp.p('hello');
END;
</ORACLE>
Why doesn't it work to call procedures from the templates???
Has anyone alse run into this?
PS! I'm using Portal version 3.0.7.6.2
Will soon upgrade to the latest version...What I'm trying to do is to do a redirect of a page depending on
some conditions which my PL/SQL procedure can determine. So I
hoped that I could call my procedure from the page template
header and the procedure would print a redirect tag, if
appropriate. Something like this:
Page template (part of..)
<HTML>
<HEAD>
<ORACLE>
BEGIN
MYSCHEMA.DO_REDIRECT;
END;
</HEAD>
The DO_REDIRECT procedure prints the META tag for a redirect of
the browser if it finds it necessary. otherwise it would do
nothing..
<META HTTP-EQUIV="Refresh"
Content = "30;
URL=http://www.oracle.com">
But calling procedures from templates as described above does
not seem to work, at least in version 3.0.7.6.2.
(We're in the process of upgrading to the latest version)
Does this work in 3.0.9 ?
...or does anyone know a better way to do this?
Any advice is really apreciated. -
WWCTX_API.GET_USER
I created a custom folder and typed following sql in that:
SELECT WWCTX_API.GET_USER from dual
there was no problem in creating this folder.
When i create a worksheet in plus and while running a query, its giving following errors
ORA-14551: cannot perform a DML operation inside a query.
ORA-06512: at "PORTAL.WWCTX_SSO",line 2954
ORA-06512: at "PORTAL.WWCTX_SSO",line 3483
ORA-06512: at "PORTAL.WWCTX_SSO",line 1735
ORA-06512: at "PORTAL.WWCTX_SSO",line 2954
ORA-06510: at PL/SQL: unhandeled user-defined exception
ORA-06512: at
Actually one of my query is based on SSO user id.
When i use this "SELECT WWCTX_API.GET_USER from dual;" on SQL prompt. Its doesn't give any error.
I need to use this WWCTX_API.GET_USER in my query. Any idea why its giving error in discoverer plus?
ThanksQuestions similar to yours have been answered earlier in the forum in these threads:
http://forums.oracle.com/forums/message.jsp?id=456180
http://forums.oracle.com/forums/message.jsp?id=628583
You can search the forums by entering your search criteria in the text field in the upper right corner of the OTN Discussion Forum Page. -
HELP!!! wwctx_api.get_user
I created a PL/SQL Server Page just to show the login information from a login portlet.
The code follows:
<%@ page language="PL/SQL" %>
<%@ plsql procedure="logininfo" %>
<HTML>
<HEAD><TITLE>This is a PSP Page!</TITLE></HEAD>
<BODY>
<%
declare
myname varchar2(50) := portal30.wwctx_api.get_user;
begin
htp.print(myname);
end;
%>
</BODY>
</HTML>
My Login portlet on success "P_request_url" calls for the above procedure.
My problem was no matter what user I logged on with, it always dispays "PUBLIC" as the login user. What I need is to get oracle portal user who is curently using the session. WHY? Please Help!
Thanks!there is a diffence between portal.wwctx_api.get_user and portal_sso.wwctx_api.get_user. Check and make sure you are using the api from the right context. You're probably getting the sso user and not the portal user.
-
Hi,
I have a portal page using 5 reports as portlets each of them use
"where personid = portal30.wwctx_api.get_user"
to limit the amout of data retrieve for each user.
I have 250 users registred in login server whose can use this page.
The 5 portlets fall in timeout every time, except if I replace "portal30.wwctx_api.get_user" by a constant,
which is not very useful but works.
Any idea to avoid usage of this API.
Thanks in advance
Didier Dubois
mail : [email protected]
mobile : +33 (0)6 74 68 54 78Hi,
Instead of using the api in the query, use a bind variable and then customize the report to pick up the value from the api. Here is an example
1) Create a sql report
select * from usertab
where user_id = :userid
2) Publish this report on a page
3) Now edit the page and go to the edit defaults of the report.
4) You will have a textbox against userid. Here you enter #<portalschema>.wwctx_api.get_user
Please replace the portalschema with the name of your portal schema.
Thanks,
Sharmila -
Help: Portal calendar error when using wwctx_api.get_user
Hi,
I am trying to create a calendar based on some table data and results should be specific to portal user logged in. So I have created following query but it does not filter the data based on the user logged in. I have checked and there are no issues on data side.
select
a.EVENT_START_DT the_date,
a.EVENT_NAME the_name,
( ) the_name_link,
null the_date_link,
null the_target,
null the_intermedia
from TBL_EVENTS a
where a.Event_Status = 0
and a.event_personal = 1
and a.event_recorded_by = (select entryid FROM ods.CT_UID where upper(ATTRVALUE) = upper(wwctx_api.get_user))
order by a.event_id desc
Failing above I also tried other way using bind variable and then passing the page paramater (selecting system variables USER_NAME) to the bind variable
Select a.EVENT_START_DT the_date,
a.EVENT_NAME the_name,
( ) the_name_link,
null the_date_link,
null the_target,
null the_intermedia
from TBL_EVENTS a
where a.Event_Status = 0
and a.event_personal = 1
and a.event_recorded_by = (select entryid FROM ods.CT_UID where upper(ATTRVALUE) = upper(:username))
order by a.event_id desc
However it still dont work.
Can anyone please give me any suggestion or way to resolve this.
Any help much appriciated.
Thanks
GaneshHi,
I am storing OID user id but I am comparing as follows
select
a.EVENT_START_DT the_date,
a.EVENT_NAME the_name,
('' ) the_name_link,
null the_date_link,
null the_target,
null the_intermedia
from TBL_EVENTS a
where a.Event_Status = 0
and a.event_personal = 1
and a.event_recorded_by = (select entryid FROM ods.CT_UID where upper(ATTRVALUE) = upper(portal.wwctx_api.get_user)
order by a.event_id desc
but this comes with following error
Unable to describe SQL statement. Please correct it (WWV-13010)
Took exception (WWV-13005)
ORA-01001: invalid cursor (WWV-11230)
ORA-00921: unexpected end of SQL command (WWV-11230)
Failed to parse as CCMPORTAL - select a.EVENT_START_DT the_date, a.EVENT_NAME the_name, ('http://portal.ccm.ac.uk/portal/page/portal/TMC/STAFFPORTAL/COLLEGE_SERVICES/COLLEGE_CALENDAR/Event%20Manager/Tab_Update?meventid=##A.EVENT_NAME##' ) the_name_link, null the_date_link, null the_target, null the_intermedia from TBL_EVENTS a where a.Event_Status = 0 and a.event_personal = 1 and a.event_recorded_by = (select entryid FROM ods.CT_UID where upper(ATTRVALUE) = upper(portal.wwctx_api.get_user) order by a.event_id desc
I then tried creating bind variable as follows
select
a.EVENT_START_DT the_date,
a.EVENT_NAME the_name,
('' ) the_name_link,
null the_date_link,
null the_target,
null the_intermedia
from TBL_EVENTS a
where a.Event_Status = 0
and a.event_personal = 1
and a.event_recorded_by = (select entryid FROM ods.CT_UID where upper(ATTRVALUE) = upper(:musername)
order by a.event_id desc
and then passing system variable USER_NAME to musername in page parameter settings to the portlet.
Please advise help
Thanks
Ganesh -
Dynamic Page Layout - Opportunity Product Revenue
Hi gurus,
I am trying to setup a dynamic template for "Opportunity Product Revenues"
I set it up successfully in the object. However, this data is exposed only as a related list of Opportunity and not directly. Now, when I go into the "Opportunity" customization, it only allows me to set up static page layouts, with no option to setup the Dynamic page layouts through the Related list.
Please help..Hi Jonathan,
Many thanks for your response.
Our CTE is already on R19. We want to experiment and be ready when our PROD is upgraded to R19.
Can you help me with the requirement, if you have an idea please? I would really appreciate the help.
Thanks -
Need to display column names in a dynamic page
Hi
I am displaying some rows returned from an sql querry in a dynamic page ...I hv written the sql querry between <ORACLE> AND </ORACLE> TAGS...The problem is ,i am not able to display the column names ...Why ? pl help....
ramYou must to use the htp package. Example:
<ORACLE>
begin
htp.tableopen('1','CENTER',null,null,'BORDER="1"');
htp.tableheader('NParte','CENTER');
htp.tableheader('Descripcisn','CENTER');
htp.tableheader('Precio/Unit','CENTER');
htp.tableheader('Servicio','CENTER');
htp.tableheader('IVA','CENTER');
htp.tableheader('Total','CENTER');
for cursor_cotiza in (select
r.Nparte as Nparte, r.Descripcion as Descripcion,
r.preciounit as preciounit,
NVL(f.servicio,0) as servicio,
round((0.145)*r.preciounit,3) as IVA,
round((0.145)*r.preciounit,3) + r.preciounit +
NVL(f.servicio,0) as PrecioTotal
from
carryin.repuestos r,
carryin.casos c, carryin.facturacion f
where r.NCaso =:NCaso
and r.Ncaso=c.NCaso
and c.Ncaso=f.Ncaso(+)
and f.servicio(+)<>0
union
select
r.Nparte as Nparte, r.Descripcion as Descripcion,
r.preciounit as preciounit,
NVL(f.servicio,0) as servicio,
round((0.145)*r.preciounit,3) as IVA,
round((0.145)*r.preciounit,3) + r.preciounit +
NVL(f.servicio,0) as PrecioTotal
from
carryin.casosneq r,
carryin.facturacion f
where r.NCaso =:NCaso
and r.Ncaso=f.Ncaso(+)
and f.servicio(+)<>0
) loop
htp.tableRowOpen('CENTER','CENTER');
htp.tableData(cursor_cotiza.Nparte,'CENTER');
htp.tableData(cursor_cotiza.Descripcion,'CENTER');
htp.tableData(cursor_cotiza.preciounit,'CENTER');
htp.tableData(cursor_cotiza.servicio,'CENTER');
htp.tableData(cursor_cotiza.IVA,'CENTER');
htp.tableData(cursor_cotiza.PrecioTotal,'CENTER');
htp.tableRowClose;
end loop;
htp.tableclose;
end;
</ORACLE>
This example show a table with header and borders. You must to see this package for more information. -
How to create a form based on table using dynamic page?
Hi,
I need to create a form using dynamic page. How do you pass values from the html form to a oracle procedure that will get executed on submission of the form ? I could not find any documents which shows how to do that. Can anyone please help me out with an example ?
thanks,
MainakHi,
Something seems to get added to the form action because of "http". Hence I am removing it.
You need to write a procedure with the values in the as parameters. Say for example you want to insert a record into dept
table then
Dynamic page code
<html>
<body>
<form action="portalschema.insert_dept">
<input type="text" name="p_deptno">
<input type="text" name="p_dname">
<input type="submit" name="p_action" value="save">
</form>
</body>
</html>
Procedure code.
create or replace procedure insert_dept
(p_deptno in number,
p_dname in varchar2,
p_action in varchar2)
is begin
if p_action = 'save' then
insert into scott.dept(deptno,dname) values(p_deptno,p_dname);
commit;
end if;
end;
grant execute on insert_dept to public;
Hope this helps.
Thanks,
Sharmila -
How to get page URL in a dynamic page in 10.1.4?
Does anyone know how to get the page URL in a Dynamic Page in 10.1.4 without using javascript.
I know that you can use a PL/SQL portlet and the portlet_record, but this is specifically for a Dynamic Page.
Regards
JennyHi,
I am trying the suggested approach in 10.1.4 but unfortunatley I get the following error:
PLS-00302: component 'SHOW_INTERNAL' must be declared
In my Dynamic Page I have the following code
htp.p(cms_context.urlpage);
In the '... before displaying the page' I have the following
schema_name.cms_context.urlpage := schema_name.dynamic_page_name.show_internal.p_page_url;
Can anyone help?
Cheers
Chris -
How to get form fields in a dynamic page as a portlet
I have a dynamic page(publish as portlet and added to a portal page) with a html form that has many radio button created dynamically (query a table and create as many radio button as records I found) and the name of each radio button is the id of the record from the table it represents.
When I click the submit button of my form it will recall the same portal page and then I have to check which radio buttons where selected to update the database depending on it.
The problem is that I can't get the radio buttons inside the dynamic page because they are created dynamically so I can't make them portlet parameters to be associated with page parameters.
So How can I tell which radio buttons have been selected?
Please help me.Hi,
Write a procedure which will be called as the form action. This procedure should take an array of parameters like p_arg_names and p_arg_values. For example
<html>
<form>
<input type="checkbox" name="p_radio">
<input type="checkbox" name="p_radio">
</form>
procedure submit_form(p_radio in wwv_utl_api_types.vc_arr)
begin
for i in 1..p_radio.count
loop
htp.p(p_radio(i));
end loop;
wwv_redirect.url(<page_url>);
end;
Hope that helps.
Thanks,
Sharmila -
Retrieve data from a dynamic page via loadURL
Hello.
I would like to ask you how it is possible to retrieve data
from a dynamic page (asp classic in my case) using the loadURL
method.
I would like to create an html authentication form (with
username and password fields). The loadURL method should call an
asp page and then pass to the usual function 'DoIfSucceded' the
results of the elaboration.
Of course I'm going to have a switch in the function in order
to make different actions depending from the results of the asp
page (authentication succeded or failed).
I had a look to the examples at this page:
Adobe
samples
Is there anyone who can explain clearly how the results data
must be written by the asp page and how the success function can
retrieve them ?
I thank you in advance for your help.loadURL() uses the the XMLHttpRequest Object so if the
content you return is XML, you have 2 choices for accessing your
data. You can either access it as a text string via the
XMLHttpRequest object's responseText property, or as a DOM document
via the XMLHttpRequest object's responseXML property:
function MySuccessCallback(req)
// If my data is XML, I can access the data that was sent
from the server
// as DOM elements via the XMLHttpRequest's responseXML
property.
var xmlDOM = req.xhRequest.responseXML;
// OR, you can access the data sent back from the server as
text via
// the XMLHttpRequest object's responseText property.
var xmlAsAString = req.xhRequest.responseText;
var req = Spry.Utils.loadURL("GET",
"/app/book.php?id=1&code=54321", true, MySuccessCallback);
If your serverside script wants to use some other format as a
response like JSON or plain text, then you can only access the data
as text via the responseText property.
--== Kin ==-- -
Error creating dynamic page in an application with a schema other than portal30
Running 9iAS 1.0.2.2 on Solaris.
Database 8.1.7.1
I cannot seem to create a default dynamic page (select 'x' from dual) in an application that has a schema (e.g. test) other
than portal30. The error seems to be when portal tries to compile the dynamic-page package, it references itself from
within the package but prefixing the call with the other (test) schema. It never seems to compile? What seems to be the
problem? Any ideas?If you are using any database object other than the applcation owned,then it has to be prefixed with the schema owner.
For example,
if the application schema is based on the schema "schema1" (say)
and your query is based on one of the object on "schema2"
and if you have necessary privilegves to access that object from schema2, then the compiler wont throw any error.
Can u explain, what u problem you are experiencing in detail?
(Also, if u give me the portal version, I can cross-verify that).
Maybe you are looking for
-
Using variables in message long text ( SE91)
Hi everyone, Does anyone know how we insert the variables passed in the message can also be used to be printed in the long text as well. Suppose , say message e000 with a b c d. where a ,b , c and d are the variables... How do i use these inside the
-
Getting access to MakeProcInstance
I have been asked to work on a legacy system written in C that has been migrated to Visual Studio and Win7. The function call MakeProcInstance is made for a locally defined CALLBACK function. But it is returning some really strange values - nothing i
-
How to remove all linked devices in keynote
Im try to relink my keynote as remote, but its imposible, becouse the devices is unlinked, but not in the sandbox Of the app
-
How to place a break-point in update rules
Hi All, Can any one let me know how to place a break-point in update rules. I used the hard code BREAK-POINT in the code, but it did not work out. After placing the BREAK-POINT in the update rules code, I executed the info package and the load was su
-
Hi- I've got RAC 9.2.0.3 up and running on two nodes, using RedHat Advanced Server 2.1, kernel 2.4.20-9.2 (from http://www.ocfs.org), and ocfs 1.0.8 (from the same website). Oracle Cluster Manager is working as well. Storage is a shared firewire driv