Skip to Main Content

APEX

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Load textbox value from selected row on submit

609458Nov 20 2007 — edited Nov 23 2007
I am relatively new to APEX (but not to programming) so forgive me if my question is silly. I have searched the internet and the forums but cannot find a solution to my problem. I also tried to include as much relevant info as possible here, so please also forgive the length of my post, if it seems too long.

I have an apex report that displays values from a view, which combines data from two different tables. By creating a custom Named Column report template, I was able to make the rows clickable. When a row is clicked, it submits back to the same page, and it should load a text box field with a (text) value from a field in the report. I tried passing in the text value directly on the onclick event for the row using (onClick=window.location='f?p=&APP_ID.:1:&SESSION.::::P1_DESCRIPTION:#DESCRIPTION#'>) in the Row Template 1 code,
but that resulted in errors in the html javascript with whitespace characters in the fields I wanted:
onclick="window.location='f?p=101:1:3002735117133445::::P1_DESCRIPTION:Business" id=""
I can submit the #ROWNUM# to a hidden field (p1_rownum) on the page - I just don't know how to properly load the value from the report into the textbox based on the value of p1_rownum . I have examined Denes Kubicek's demo here: http://htmldb.oracle.com/pls/otn/f?p=31517:38:5635723234572621::NO which appears to be customizable to what I want to do, but I have so far been unable to get the code to work. I suspect that the problem is with the apex_application.g_f02 naming convention, since I am not using a tabular report. If I create a process using the following code:
BEGIN
IF :p1_rownum IS NOT NULL THEN
:p1_description := :p1_rownum;
END IF;
END;
-it loads the rownum value correctly into the text box field - but no matter what values I substitute in for apex_application or g_f02 (which is the correct column number), I get an error when trying to get the real value I want.

If I use the (after footer) process code:
BEGIN
IF :p1_rownum IS NOT NULL AND length(trim(:p1_rownum))>0 THEN
:p1_description := apex_application.g_f02(:p1_rownum);
END IF;
END;

-I simply get a 'ORA-01403: no data found' error. If I use:
BEGIN
IF :p1_rownum IS NOT NULL AND length(trim(:p1_rownum))>0 THEN
:p1_description := apex_application.description(:p1_rownum);
END IF;
END;

-I get a 'ORA-06550: line 3, column 40: PLS-00302: component 'DESCRIPTION' must be declared ORA-06550: line 3, column 4: PL/SQL: Statement ignored' error.

The only thing I can think of at this point is to add a calculated rownum field to the view itself and then use a pl/sql query to load the value into the textbox from the process, but that doesn't seem ideal - there should be a way to access the values in the report once the report has been loaded to the page. Any ideas would be greatly appreciated -

Thanks in advance.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Dec 21 2007
Added on Nov 20 2007
1 comment
653 views