Apex_application.g_print_success_message
Hi all..
Please help me with the following issue.
I have a PL/SQL process on a page (after submit process).
I am using
""apex_application.g_print_success_message"" variable to show any error message.
Ex: apex_application.g_print_success_message := 'Process failed at this step';It seems "apex_application.g_print_success_message" variable is for success messages .
I want my "'error message"" to show in the same way as my ""validation error messages"" , as they are really ""error message"".
I also tried to use ""apex_application.g_notification"" but it didn't worked. My message is not showing up.
I tried to use the following code, but it seems it counts the error count
only for the ""validation error messages"" , not the error message that i set in the process.
{code}
if nvl(apex_application.g_inline_validation_error_cnt,0) = 0 then
<real code here>
end if;
{code}
Thanks
Hi Luis or anyone....
Luis..Thanks for your replies regarding this issue.
As i said in one of my previous step, I don't have option to move my code to ""validations""
This is the overview of what my process do.
begin
-- do some steps
call_database_procudre(return_code);
if return_code = 'OK' then
apex_application.g_print_success_message := 'Success mesasge';
-- do other steps
else
apex_application.g_print_success_message := 'Fail Message'; """I want this one to show like ""error"" """
-- How can i style it to show like in ""error message""" template.
-- do other steps
end if;
{code}
Anyone..PLease help me to solve this issue.
Thanks
Similar Messages
-
Problem with checkboxes in IR report mainly for update process please help
Hello,
Can anyone please help me out with this issue.
I have an interactive report with 3 checkbox item for a single column named status. Based on the value of the column status the check box should be checked. For example:
DECODE(status,'DEV',1,0) as DEV,
DECODE(status,'RVW',1,0) as RVW,
DECODE(status,'PRD',1,0) as PROD,
So for this I have used the apex_item.checkbox item. Below is my report query
SELECT APEX_ITEM.HIDDEN(30,0,'','f30_' || ROWNUM)
|| APEX_ITEM.HIDDEN(31,0,'','f31_' || ROWNUM)
|| APEX_ITEM.HIDDEN(01,ROWNUM,'','f01_' || ROWNUM)
|| APEX_ITEM.HIDDEN(04,CHF_DATASTORE||CHF_SCHEMA||CHF_TABLE||CHF_COLUMN,'','f04_' || ROWNUM)
|| APEX_ITEM.HIDDEN(05,CHF_STATUS,'','f05_' || ROWNUM)
|| APEX_ITEM.HIDDEN(06,CHF_STATUS,'','f06_' || ROWNUM)
|| APEX_ITEM.HIDDEN(08,CHF_STATUS,'','f08_' || ROWNUM)
|| APEX_ITEM.HIDDEN(09,CHF_STATUS,'','f09_' || ROWNUM)
|| APEX_ITEM.HIDDEN(11,CHF_STATUS,'','f11_' || ROWNUM)
|| APEX_ITEM.HIDDEN(12,CHF_STATUS,'','f12_' || ROWNUM)
|| APEX_ITEM.CHECKBOX (32,ROWNUM,'onClick="javascript:ToggleValue(this,' || ROWNUM || ','||'''f30'');"'
,DECODE (0,1, ROWNUM),':','f32_' || ROWNUM) DELETE
,CHF_COLUMN
,CHF_STATUS
,APEX_ITEM.CHECKBOX (07,ROWNUM,'onClick="javascript:ToggleValue(this,' || ROWNUM || ','||'''f05'');"',DECODE (CHF_STATUS,'DEV',ROWNUM),':','f07_' || ROWNUM)
DEV_EDIT
,APEX_ITEM.CHECKBOX (10,ROWNUM,'onClick="javascript:ToggleValue(this,' || ROWNUM || ','||'''f08'');"',DECODE (CHF_STATUS,'RVW',ROWNUM),':','f10_' || ROWNUM)
RVW_EDIT
,APEX_ITEM.CHECKBOX (13,ROWNUM,'onClick="javascript:ToggleValue(this,' || ROWNUM || ','||'''f11'');"',DECODE (CHF_STATUS,'PRD',ROWNUM),':','f13_' || ROWNUM)
PRD_EDIT
FROM CHF_COLUMN WHERE
CHF_DATASTORE = 'DOMAIN_DEV' AND
CHF_SCHEMA = 'SCHEMA_DEV' AND
CHF_TABLE = 'EMPLOYEEE'
ORDER BY 1; And I have a button for the update process so that the users can check the checkboxes option for the status column either 'DEV', 'RVW', 'PRD'. The status of the column can be in either of these states or can be null.
I have a update process, its having some problem - I don't understand whats causing the problem. Below is the error message which I encountered when trying to update.
ORA-06502: PL/SQL: numeric or value error: character to number conversion error
My Update process.
DECLARE
l_cnt BINARY_INTEGER := 0;
l_stepid number := 10;
l_date DATE := SYSDATE;
BEGIN
FOR i IN 1 .. apex_application.g_f01.COUNT
LOOP
IF APEX_APPLICATION.G_f05 (i) = 1 THEN
UPDATE CHF_COLUMN
SET CHF_STATUS = 'DEV'
WHERE CHF_DATASTORE||CHF_SCHEMA||CHF_TABLE||CHF_COLUMN = APEX_APPLICATION.G_f04 (i)
l_cnt := l_cnt + SQL%ROWCOUNT;
apex_application.g_print_success_message := apex_application.g_print_success_message ||
'Successfully updated'||l_cnt ||'<br><br>';
END IF;
IF APEX_APPLICATION.G_f08 (i) = 1 THEN
UPDATE CHF_COLUMN
SET CHF_STATUS = 'RVW'
WHERE CHF_DATASTORE||CHF_SCHEMA||CHF_TABLE||CHF_COLUMN = APEX_APPLICATION.G_f04 (i)
l_cnt := l_cnt + SQL%ROWCOUNT;
apex_application.g_print_success_message := apex_application.g_print_success_message ||
'Successfully updated'||l_cnt ||'<br><br>';
END IF;
IF APEX_APPLICATION.G_f11 (i) = 1 THEN
UPDATE CHF_COLUMN
SET CHF_STATUS = 'PRD'
WHERE CHF_DATASTORE||CHF_SCHEMA||CHF_TABLE||CHF_COLUMN = APEX_APPLICATION.G_f04 (i)
l_cnt := l_cnt + SQL%ROWCOUNT;
apex_application.g_print_success_message := apex_application.g_print_success_message ||
'Successfully updated'||l_cnt ||'<br><br>';
END IF;
END LOOP;
COMMIT;
END;If you can please have a look at the app, you can get a better understanding of my problem.
Workspace : orton_workspace
username : [email protected]
password : sanadear
Application No: 15089 SAMPLE_CHECKBOX_APP
Thanks,
Orton
Edited by: orton607 on Aug 4, 2010 9:28 AMI could be wrong but maybe change the hidden items to be like:
APEX_ITEM.HIDDEN(05,DECODE(CHF_STATUS,'DEV',1,0),'','f05_' || ROWNUM)
APEX_ITEM.HIDDEN(08,DECODE(CHF_STATUS,'RVW',1,0),,'','f08_' || ROWNUM)
APEX_ITEM.HIDDEN(11,DECODE(CHF_STATUS,'PRD',1,0),,'','f11_' || ROWNUM)so that the values are 0/1?
Also, you have
DECODE (CHF_STATUS,'DEV',ROWNUM)instead of
DECODE (CHF_STATUS,'DEV',0,1)in the checkboxes, as I would expect.
I'm also not sure why you need to duplicate the checkboxes (f07,f10,f13) as hidden items (f05, f08, f11) if they are both 0/1 values. -
Tabular form validation(Checkbox) is not working for Interactive report
Hi,
I am using the oracle apex 4.0 and oracle 11g.
I have written a below select query on interactive report as
select
apex_item.checkbox(1,RESIDD)||apex_item.hidden(2,RESIDD) row_selector,
apex_item.text(3,RESNUM) as resnum
from "PDRRES"
and written the validation to display the error message( Function returning error text ) as
DECLARE
vRow BINARY_INTEGER;
BEGIN
-- apex_application.g_print_success_message := NULL;
FOR i IN 1 .. apex_application.g_f01.COUNT
LOOP
vRow := apex_application.g_f01(i);
apex_application.g_print_success_message := apex_application.g_f01(i)||'-'|| apex_application.g_f03(vRow) ;
END LOOP;
END;
Output : No data found error message
As far as it work for sql report with above logic because apex built in row selector
but it fails in case of interactive report for some reason.
Please suggest.Saroj Nayak wrote:
Hi,
I am using the oracle apex 4.0 and oracle 11g.
I have written a below select query on interactive report as
select
apex_item.checkbox(1,RESIDD)||apex_item.hidden(2,RESIDD) row_selector,
apex_item.text(3,RESNUM) as resnum
from "PDRRES"
and written the validation to display the error message( Function returning error text ) as
DECLARE
vRow BINARY_INTEGER;
BEGIN
-- apex_application.g_print_success_message := NULL;
FOR i IN 1 .. apex_application.g_f01.COUNT
LOOP
vRow := apex_application.g_f01(i);
apex_application.g_print_success_message := apex_application.g_f01(i)||'-'|| apex_application.g_f03(vRow) ;
END LOOP;
END;
Output : No data found error message
As far as it work for sql report with above logic because apex built in row selector
but it fails in case of interactive report for some reason.
Please suggest.NO DATA FOUND usually occurs when an i mplicit select does not find anything. It can also occur when referencing a collection element that has not been defined.
You have 2 collectinons in the code you posted, apex_application.g_f01() and apex_applciation.g_f03. Since you are looping therough the COUNT attribute of g_f01 its reference ("I") is probably okay and the value store in vRow is probably not right. You can check this by using RAISE_APPLICTION_ERROR to see the value something like
raise_application_error(-20000,'vRow="'||vRo2||'"');Remember that working with checkboxes is tricky. If the box is not checked nothing will be sent. You may need to define a default value when no value is submitted. -
How to display a line-in notifcation message after logout ?
Hi,
Is there a way to display a notification message (in line notification) in page 1 to notify user there has been disconnected from the application ?
The application is using this logout URL :
wwv_flow_custom_auth_std.logout?p_this_flow=&APP_ID.&p_next_flow_page_sess=&APP_ID.:1Page 1 is the "home" page of the application. This page is public (not authentification needed).
Regards,
ChrisitanAs a late evening thought, try messing with this at a relevant PL/SQL process
apex_application.g_print_success_message := 'Your message';
SW -
Making apex_util.get_print_document return an error message
We are using apex_util.get_print_document in a process to run a report something like this:
declare
l_report blob := null;
begin
l_report := apex_util.get_print_document (
p_application_id => :APP_ID,
p_report_query_name => 'report_query_name',
p_report_layout_name => 'report_layout_name',
p_report_layout_type => 'rtf',
p_document_format => 'rtf'
if l_report is not null and dbms_lob.getlength(l_report) > 0 then
apex_application.g_print_success_message := 'Report Created.<br>';
INSERT INTO reports (attachment, date_created, filename, mime_type)
VALUES (l_report, sysdate, 'report.rtf', 'text/rtf' );
else
apex_application.g_print_success_message := '<span style="color:#CC0000">There was a problem creating the report.</span><br>';
end if;
end;And this works well most of the time. The problem is, if the report fails for some reason, apex_util.get_print_document gives no information whatsoever as to what went wrong. Is there any way at all we can find out what the problem was?
Application Express 4.0.2.00.07
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit ProductionHi,
add exception to your code.
declare
l_report blob := null;
begin
l_report := apex_util.get_print_document (
p_application_id => :APP_ID,
p_report_query_name => 'report_query_name',
p_report_layout_name => 'report_layout_name',
p_report_layout_type => 'rtf',
p_document_format => 'rtf'
if l_report is not null and dbms_lob.getlength(l_report) > 0 then
apex_application.g_print_success_message := 'Report Created.<br>';
INSERT INTO reports (attachment, date_created, filename, mime_type)
VALUES (l_report, sysdate, 'report.rtf', 'text/rtf' );
else
apex_application.g_print_success_message := '<span style="color:#CC0000">There was a problem creating the report.</span><br>';
end if;
EXCEPTION
WHEN OTHERS THEN
raise_application_error(-20001,'An error was encountered - '||SQLCODE||' -ERROR- '||SQLERRM);
end;This will give proper error message.
Hope this will helps you.
Regards,
Jitendra -
Calling a Procedure from a Button? (REVISITED)
Hi All,
I once asked a question Re: Calling a Procedure from a Button? & that problem was resolved when i was working on the online ApEx.
On my application, requirements have changed a bit: I have one form based on two tables. One table contributes two fields (name & surname) to the form while the remaining fields are contributed by another table to make a total of 17 fields on the form.
My process is in such a way that a user enters an id number & clicks Search button, if the apllicant exists then both name & surname corresponding with the id number will be retrieved from the database. If the applicant does not exist then an error message will be displayed inline with the id number field. Here's the PL/SQL anonymous block to that:
DECLARE
vNAME APPLICANTS.name%TYPE;
vSURNAME APPLICANTS.surname%TYPE;
BEGIN
SELECT count(*)
INTO :P2_COUNT
FROM applicants
WHERE id_number = :P2_ID_NUMBER;
IF :P2_COUNT > 0 THEN
SELECT name,surname
INTO vNAME, vSURNAME
FROM applicants
WHERE id_number = :P2_ID_NUMBER;
:P2_NAME := vNAME;
:P2_SURNAME := vSURNAME;
ELSE
apex_application.g_print_success_message := '<span style="color:red">Applicant does not exist.</span>';
END IF;
EXCEPTION WHEN NO_DATA_FOUND THEN
apex_application.g_print_success_message := '<span style="color:red">Exception Caught.</span>';
END;The PL/SQL block works except for error displaying part (but that's a problem for another day).
NB: On my application, there’s already Automated Row Fetch & Automatic Row Processing (DML) processes for one table. Furthermore, there is also a javascript for verifying the validity of an id number. As a result, I decided to include Automated Row Fetch & Automatic Row Processing (DML) processes for the other table. When I click a Search button the javascript is activated even though I did not specify a URL target for the button - because this is a simple button among region items – it does not have Optional Url Redirect section.
I'm not sure what I'm doing wrong here - any help is appreciated.
Regards
KamoHi Dan,
Sorry for causing confusion with my post - it's just that I was asking the same question (with different constraints) as I had asked before so I didn't feel like going to details was necessary because in my post I included a link to the previous thread. Interestingly, I was working on apex.oracle.com when I posted the original thread - the only problem came to be when I started to move the solution to my application on my machine.
Anyway, thanks for the response!
Regards
Kamo -
Help with uploading an excel file to a table using an application
Hello,
Can anyone please help me out with this issue. I have apex application where in the end users upload an excel file to a table. For this I have followed the solution provided in this link
http://avdeo.com/2008/05/21/uploading-excel-sheet-using-oracle-application-express-apex/
Using the above solution, I was able to upload the excel data to a table "sample_tbl1" successfully with fields Id,acct_no,owner_name,process_dt. But the thing is I want accomdate a particular condition while uploading the file data, to check see if the acct_no already exists in another table say "sample_tbl2" or not. If acct_nos already exists in sample_tbl2 then give out an error displaying the list of account numbers that already exists in the database. Below is the code which I am using to upload file data to a table.
DECLARE
v_blob_data BLOB;
v_blob_len NUMBER;
v_position NUMBER;
v_raw_chunk RAW(10000);
v_char CHAR(1);
c_chunk_len number := 1;
v_line VARCHAR2 (32767) := NULL;
v_data_array wwv_flow_global.vc_arr2;
v_rows number;
v_sr_no number := 1;
l_cnt BINARY_INTEGER := 0;
l_stepid NUMBER := 10;
BEGIN
--Read data from wwv_flow_files</span>
select blob_content into v_blob_data
from wwv_flow_files
where last_updated = (select max(last_updated) from wwv_flow_files where UPDATED_BY = :APP_USER)
and id = (select max(id) from wwv_flow_files where updated_by = :APP_USER);
v_blob_len := dbms_lob.getlength(v_blob_data);
v_position := 1;
/* Evaluate and skip first line of data
WHILE (v_position <= v_blob_len ) LOOP
v_raw_chunk := dbms_lob.substr(v_blob_data,c_chunk_len,v_position);
v_char := chr(hex_to_decimal(rawtohex(v_raw_chunk)));
v_line := v_line || v_char;
v_position := v_position + c_chunk_len;
-- When a whole line is retrieved
IF v_char = CHR(10) THEN
-- Clear out
v_line := NULL;
EXIT;
END IF;
END LOOP;
-- Read and convert binary to char</span>
WHILE ( v_position <= v_blob_len ) LOOP
v_raw_chunk := dbms_lob.substr(v_blob_data,c_chunk_len,v_position);
v_char := chr(hex_to_decimal(rawtohex(v_raw_chunk)));
v_line := v_line || v_char;
v_position := v_position + c_chunk_len;
-- When a whole line is retrieved </span>
IF v_char = CHR(10) THEN
-- Convert comma to : to use wwv_flow_utilities </span>
v_line := REPLACE (v_line, ',', ':');
-- Convert each column separated by : into array of data </span>
v_data_array := wwv_flow_utilities.string_to_table (v_line);
-- Insert data into target table
EXECUTE IMMEDIATE 'insert into sample_tbl1(ID,ACCT_NO,OWNER_NAME,PROCESS_DT)
values (:1,:2,:3,:4)'
USING
v_sr_no,
v_data_array(1),
v_data_array(2),
to_date(v_data_array(3),'MM/DD/YYYY');
-- Clear out
v_line := NULL;
v_sr_no := v_sr_no + 1;
l_cnt := l_cnt + SQL%ROWCOUNT;
END IF;
END LOOP;
delete from wwv_flow_files
where last_updated = (select max(last_updated) from wwv_flow_files where UPDATED_BY = :APP_USER)
and id = (select max(id) from wwv_flow_files where updated_by = :APP_USER);
l_stepid := 20;
IF l_cnt = 0 THEN
apex_application.g_print_success_message := apex_application.g_print_success_message || '<p><span style="font-size:14;font-weight:bold">Please select a file to upload.</span></p>' ;
ELSE
apex_application.g_print_success_message := apex_application.g_print_success_message || '<p><span style="font-size:14;font-weight:bold;color:green">File uploaded and processed ' || l_cnt || ' record(s) successfully.</span></p>';
END IF;
l_stepid := 30;
EXCEPTION WHEN OTHERS THEN
ROLLBACK;
apex_application.g_print_success_message := apex_application.g_print_success_message || '<p><span style="font-size:14;font-weight:bold;color:red">Failed to upload the file. '||REGEXP_REPLACE(SQLERRM,'[('')(<)(>)(,)(;)(:)(")('')]{1,}', '') ||'</span></p>';
END;
{code}
Can anyone please help me, how do i accomdate the condition within my existing code.
thanks,
OrtonOrton,
From your code it appears that the account No comes in the second column of the file = > v_data_array(1)
So You can put a conditional block around the execute immediate code that inserts the records
For instance
SELECT count(1) INTO ln_account_no_exists from <"sample_tbl2> where account_no = v_data_array(1);
IF ( ln_account_no_exists > 0 ) THEN
--Account No: already exists
<Do what you want to do here >
ELSE
EXECUTE IMMEDIATE ...
END IF:
{code}
Inorder to handle the account no records which exists you can
<li>Raise an exception
<li> Write record to table or insert into collection and then use a report region in the page based on this table/collection to show error records
<li> Append errored account No:s to the Success Message Variable programmatically(this variable is used by PLSQL process success/error message )
{code}
IF ( record exists)
apex_application.g_print_success_message := apex_application.g_print_success_message||','|| v_data_array(1) ; -- Comma separated list of errored account no:s
ELSE ...
{code}
Hope it helps -
Add Column Delete in report, How to delete row using this delete Option
Hi Friends,
i have a report ,iwant to add an option DELETE in last column.When i click on DElete then respective id sholund be deleted.
My Table Is
CREATE TABLE "DUMY_FILE"
( "ID" NUMBER,
"NAME" VARCHAR2(500),
"FILE_OBJ_ID" NUMBER,
"MIME_TYPE" CLOB,
"DOC_SIZE" NUMBER,
"BLOB_CONTENT" BLOB,
"DESCRIPTION" VARCHAR2(500),
"UPLOAD_DATE" CHAR(25)
How can i do this.
Thanks
Edited by: 805629 on Nov 16, 2010 11:51 PMTrent,
Thanks for you suggestions. .. Let me explain my problem a little better ...
I have a report that lists fields associated with a report ... I have a delete icon which deletes a row and removes it from the underlying table ... however, I am trying to implement a Before header process which runs a pl/sql process that checks if the selected field is the last field in the report ... if so, I want a confirmation dialog to pop up ... if they click cancel .. then the deletion is aborted, else the field is deleted (which triggers other status changes).
Based on this logic if there is a way to implement this based on your suggestion I would appreciate it ...
Here is the process I was trying to use .... but the I have a few issues with this approach
declare
-- cursor to check if this is the last field
cursor fld_cnt is
select count(*) from prm_ptnr_rpt_fields
where report_uid = :P22_REPORT_UID;
num_flds number;
msg varchar2(300);
begin
open fld_cnt;
fetch fld_cnt into num_flds;
If num_flds > 1 then
delete from prm_ptnr_rpt_fields
where report_uid = :P22_REPORT_UID
and field_user_key = :P9_DELETED_FLD;
commit;
:P9_DELETED_FLD := NULL;
msg := :P9_FIELD_NAME || ' Field Excluded From Report' ;
apex_application.g_print_success_message := msg;
else
htp.p('<script type="text/javascript">');
htp.p('
var r=confirm("This is the last field included in this report .. \n Deleting it will Inactivate the report and remove it from schedule (if scheduled) ...\n Do you want to proceed?");
if (r==true)
{ delete from prm_ptnr_rpt_fields
where report_uid = :P22_REPORT_UID
and field_user_key = :P9_DELETED_FLD;
:P9_DELETED_FLD := NULL;
commit;
msg := :P9_FIELD_NAME || ' Field Excluded From Report' ;
update prm_ptnr_rpts
set report_status = 'INCOMPLETE',
active_report = 'N'
where report_uid = :P22_REPORT_UID;
msg := msg || ' and Report Status changed to INCOMPLETE';
apex_application.g_print_success_message := msg;
htp.p('}else {
alert("Delete Action Aborted");
htp.p('</script>');
End if;
Close fld_cnt;
end;
a) Even if I click cancel ... the field still gets deleted ...
b) :P9_DELETED_FLD is the id for the selected field ... I am setting it on the link attributes which places it on the URL ... I would rather user javascript (but not exactly sure how).
Thanks,
Gerald
Edited by: user5459177 on Feb 22, 2011 2:45 PM -
Display A Success Message From An Application Process
Apex 3.2
I have an on demand application process, which is resetting my application, except application items
BEGIN
FOR c IN (SELECT page_id
FROM apex_application_pages
WHERE application_id = :app_id)
LOOP
apex_util.clear_page_cache (c.page_id);
END LOOP;
:F270_REFRESH_INTERVAL := null;
END;
I have a list item that calls some javascript on page zero
<script type="text/javascript">
function resetapp(){
var answer=confirm("Do you really want to reset the application ?");
if(answer==true) {
var get = new htmldb_Get(null, null, 'APPLICATION_PROCESS=RESET_APPLICATION');
var gReturn = get.get();
redirect('f?p=&APP_ID.:1:&APP_SESSION.');
</script>
The user clicks on the item in the list. A confirmation appear and when they click ok,
then the on demand process runs and they are directed to page 1.
This is all working ok.
My problem is that I would like to display a message (a sucesss message) on page 1.
I have an unconditional branch on page 1 with the tick box checked for include process message.
I have tried the following in my application process, but none seem to work.
apex_application.g_print_success_message := 'Application Has Been Reset';
htp.prn('Application Has Been Reset');
HTP.P('Application Has Been Reset');
How can I do this ?
GusCan anyone help ?
Gus -
Set ajax value to the textbox[in modal box jquery]
Hi,
In my page i have one interactive report with 2 button add and edit, i have used modal box j-query for the button add and edit. Adding the data through modal box working fine.
when tried to edit the existing data i am not able set the data to the corresponding textbox in apex.
please find my modal box script:
<link rel="stylesheet" href="#APP_IMAGES#modal-jquery-ui.css" type="text/css">
<script src=#APP_IMAGES#modal-jquery.js type="text/javascript"></script>
<script src=#APP_IMAGES#modal-jquery-ui.js type="text/javascript"></script>
<script type="text/javascript">
$( function() {
$('#ModalForm').dialog({
modal : true ,
width: 550,
height: 300,
autoOpen : false,
resizable: false,
buttons : {
Cancel : function() {
closeForm();
Add : function() {
addPerson();
$('#ModalForm1').dialog({
modal : true ,
width: 550,
height: 300,
autoOpen : false,
resizable: false,
buttons : {
Cancel : function() {
closeForm1();
Update : function() {
updateperson();
function openForm(){
$('#ModalForm').dialog('open');
function openFormclose(){
$('#ModalForm1').dialog('open');
alert('opened');
var updateval = document.getElementById('P37_UPDATEID').value;
var get = new htmldb_Get(null,html_GetElement('pFlowId').value, 'APPLICATION_PROCESS=updateperson',0);
get.add('P37_UPDATEID',updateval);
var gReturn = get.get();
alert(gReturn);
document.getElementById('P37_UPADATEPRONAME').value = gReturn;
function closeForm1(){
$('#ModalForm1 input[type="text"]').val('');
$('#ModalForm1').dialog('close');
function closeForm(){
$('#ModalForm input[type="text"]').val('');
$('#ModalForm').dialog('close');
function addPerson(){
if (document.getElementById('P37_ADDSOFTDETAILS').value == ""){
alert('Please Enter Software Details.');
return false;
if (document.getElementById('P37_ADDSOFTVERSION').value == ""){
alert('Please Enter Software Version.');
return false;
if (document.getElementById('P37_STANDARD').value == ""){
alert('Please Enter Software Standard.');
return false;
var ajaxRequest = new htmldb_Get( null , &APP_ID. , 'APPLICATION_PROCESS=addPerson', 0);
ajaxRequest.add( 'P37_ADDSOFTDETAILS', $v('P37_ADDSOFTDETAILS'));
ajaxRequest.add( 'P37_ADDSOFTVERSION', $v('P37_ADDSOFTVERSION'));
ajaxRequest.add( 'P37_STANDARD', $v('P37_STANDARD'));
ajaxRequest.get();
ajaxRequest = null;
closeForm();
gReport.search('SEARCH');
</script>
and find the corresponding on demand process below:
addPerson:
DECLARE
BEGIN
INSERT INTO xxxxxx.yyyyyyyyyy (
INT_PRODUCT_SEQ,
INT_PRODUCT_NAME,
INT_PRODUCT_VERSION,
INT_PRODUCT_VERSION_DEFINE,
CREATED_BY,
CREATED_DATE
VALUES (xxxxxx.INT_ADD_SOFTDETAILS_SEQ.NEXTVAL,
:P37_ADDSOFTDETAILS,
:P37_ADDSOFTVERSION,
:P37_STANDARD,
V ('APP_USER'),
SYSDATE);
COMMIT;
apex_application.g_print_success_message := 'Record Inserted Successfully.';
EXCEPTION
WHEN OTHERS
THEN
apex_application.g_print_success_message := 'Falied to Inserted Data.';
END;
and updateperson: is
DECLARE
v_product_name varchar2 (240);
v_product_version varchar2 (240);
v_product_version_standard varchar2 (240);
v_update varchar2 (240);
BEGIN
BEGIN
SELECT INT_PRODUCT_NAME,
INT_PRODUCT_VERSION,
INT_PRODUCT_VERSION_DEFINE
INTO v_product_name, v_product_version, v_product_version_standard
FROM xxxxxxx.yyyyyyyyy
WHERE INT_PRODUCT_SEQ = :P37_UPDATEID;
HTP.prn (v_product_name);
EXCEPTION
WHEN OTHERS
THEN
HTP.prn( 'An error was encountered - '
|| SQLCODE
|| ' -ERROR- '
|| SQLERRM);
END;
END;Hi,
First of all:
I can't find any definition of the function updateperson(); called in $('#ModalForm1').dialog - button Update.
There is alert('opened'); only. There should be declaration of the updateperson() function.
There isn't setting of the corresponding items when the update modal form opened.
I use it this way.
function openForm(v_add_details, v_add_softv, v_stand)
$('#ModalForm').dialog('open');
$s('P37_ADDSOFTDETAILS', v_add_details);
$s('P37_ADDSOFTVERSION', v_add_softv);
$s('P37_STANDAR', v_stand));
}where the P12_X ... items are the modal form items. and the v_ ... parameters are the parameters of corresponding columns from report. (you have there something like: redirect to URL: javascript: openFormclose();
It should be changed to something like openFormclose('#P37_ADDSOFTDETAILS#', '#P37_ADDSOFTVERSION#', '#P37_STANDARD#');
Maybe this example will guide to you a little :D
otherwise try to reproduce your solution on apex.oracle.com. there i can modify your code to make it work.
EDIT: I use the PLUGIN posted by Denes. It works well too. I used above solution before the plugin was released.
regards
J :D
Edited by: jozef_SVK on 10.5.2013 4:07 -
Load CSV file into a table when a button is clicked by the user
Hello,
Can anyone please help me out with this issue, I have a form where in a user comes and uploads a CSV file and clicks a button, when the button is clicked - it should load the CSV file data into the database table for the corresponding columns.
Can anyone please suggest me a possible solution or an approach.
Thanks,
Orton
Edited by: orton607 on May 5, 2010 2:00 PMthanks fro replying.
I have tried your changes but its not working. One more question is that I am having one column which contains commas, when I tried to load the file its failing. I think its the problem with commas. So I have changed the code to use the replace function for that column, then also its not working. Can anyone please suggest a possible approach. Below is my source code for your reference.
DECLARE
v_blob_data BLOB;
v_blob_len NUMBER;
v_position NUMBER;
v_raw_chunk RAW(10000);
v_char CHAR(1);
c_chunk_len NUMBER := 1;
v_line VARCHAR2 (32767):= NULL;
v_data_array wwv_flow_global.vc_arr2;
v_rows NUMBER;
v_sr_no NUMBER := 1;
l_cnt BINARY_INTEGER := 0;
l_stepid NUMBER := 10;
BEGIN
delete from sample_tbl;
-- Read data from wwv_flow_files</span>
select blob_content into v_blob_data from wwv_flow_files
where last_updated = (select max(last_updated) from wwv_flow_files where UPDATED_BY = :APP_USER)
and id = (select max(id) from wwv_flow_files where updated_by = :APP_USER);
v_blob_len := dbms_lob.getlength(v_blob_data);
v_position := 1;
-- Read and convert binary to char</span>
WHILE ( v_position <= v_blob_len ) LOOP
v_raw_chunk := dbms_lob.substr(v_blob_data,c_chunk_len,v_position);
v_char := chr(hex_to_decimal(rawtohex(v_raw_chunk)));
v_line := v_line || v_char;
v_position := v_position + c_chunk_len;
-- When a whole line is retrieved </span>
IF v_char = CHR(10) THEN
-- Convert comma to : to use wwv_flow_utilities </span>
v_line := REPLACE (v_line, ',', ':');
-- Convert each column separated by : into array of data </span>
v_data_array := wwv_flow_utilities.string_to_table (v_line);
-- Insert data into target table </span>
EXECUTE IMMEDIATE 'insert into sample_tbl(col1..col12)
values (:1,:2,:3,:4,:5,:6,:7,:8,:9,:10,:11,:12)'
USING
v_sr_no,
v_data_array(1),
v_data_array(2),
v_data_array(3),
v_data_array(4),
v_data_array(5),
v_data_array(6),
v_data_array(7),
v_data_array(8),
REPLACE(v_data_array(9), ':', ','),
to_date(v_data_array(10),'MM/DD/YYYY'),
v_data_array(11);
-- Clear out
v_line := NULL;
v_sr_no := v_sr_no + 1;
l_cnt := l_cnt + SQL%ROWCOUNT;
END IF;
END LOOP;
COMMIT;
l_stepid := 20;
IF l_cnt = 0 THEN
apex_application.g_print_success_message := apex_application.g_print_success_message || ' Please select a file to upload ' ;
ELSE
apex_application.g_print_success_message := apex_application.g_print_success_message || 'File uploaded and processed ' || l_cnt || ' record(s) successfully.';
END IF;
l_stepid := 30;
EXCEPTION WHEN OTHERS THEN
ROLLBACK;
apex_application.g_print_success_message := apex_application.g_print_success_message || 'Failed to upload the file. '||REGEXP_REPLACE(SQLERRM,'[('')(<)(>)(,)(;)(:)(")('')]{1,}', '') ;
END;
Below is the function which I am using to convert hex to decimal
create or replace function hex_to_decimal( p_hex_str in varchar2 ) return number
is
v_dec number;
v_hex varchar2(16) := '0123456789ABCDEF';
begin
v_dec := 0;
for indx in 1 .. length(p_hex_str)
loop
v_dec := v_dec * 16 + instr(v_hex,upper(substr(p_hex_str,indx,1)))-1;
end loop;
return v_dec;
end hex_to_decimal;
thanks,
Orton -
How do you close a database link in Apex?
How do you close a database link in Apex that is referenced in an interactive report on Page 1? I want to make sure the database link is closed before a user navigates to another page in the Apex application.
Lets assume the database link is referenced in the region source for Page 1 as follows:
Page 1 - Employee Listing
Region Source:
select ename, job, hiredate
from scott.emp@link1
Any suggestions are appreciated.
Ms. HJohn,
I figured out how to eliminate the ORA-02020 and ORA-02081 errors. The solution is reference below:
1. Create an interactive report in a page.
2. Add the SQL statement in the region source as listed below:
SELECT ENAME, JOB, HIREDATE
FROM SCOTT.EMP@DBLINK
WHERE (UPPER(ENAME) LIKE '%' || UPPER(:P1_TEXT_SEARCH)||'%')
Conditional Display
Condition Type:
PL/SQL Expression
Expression 1
:P1_TEXT_SEARCH IS NOT NULL
3. Add a search button and text search field as items on the page.
4. Create a process in the page to check the cursor and catch an exception as listed below:
Name: CHECK_CURSOR
Sequence: 30
Point: On Submit - After Computations and Validations
Type: PL/SQL Anonymous Block
PL/SQL Process:
FOR C1 IN (SELECT ENAME, JOB, HIREDATE
FROM SCOTT.EMP@DBLINK
WHERE (UPPER(ENAME) LIKE '%' || UPPER(:P1_TEXT_SEARCH)||'%'))
LOOP
IF C1.ENAME IS NOT NULL
THEN
HTP.P('Employee Name: '||C1.ENAME||' ');
END IF;
END LOOP;
EXCEPTION
WHEN NO_DATA_FOUND
THEN
APEX_APPLICATION.G_PRINT_SUCCESS_MESSAGE := 'No Data Found Error';
WHEN OTHERS THEN
APEX_APPLICATION.G_PRINT_SUCCESS_MESSAGE := 'Unexpected Error';
Conditional Processing
When Button Pressed (Process After Submit When This Button is Pressed)
P1_SEARCH_DATA
5. Create a process in the page to close the database link as listed below:
Name: CLOSE_DBLINK
Sequence: 40
Point: On Submit - After Computations and Validations
Type: PL/SQL Anonymous Block
PL/SQL Process:
COMMIT;
EXECUTE IMMEDIATE 'ALTER SESSION CLOSE DATABASE LINK DBLINK';
Conditional Processing
When Button Pressed (Process After Submit When This Button is Pressed)
P1_SEARCH_DATA
6. Apply changes, run the page, and conduct a test.
I hope this solution is helpful to others.
Ms. H -
Error / sucess message in processes
got kind of a 'stupid' question:
I updated a page (which contains a list) and set error/sucess messages for an insert/delete process (after submit) which is called everytime the user enters data in the list or deletes a record from the list.
But the error/success message isn't shown on the page - what went wrong? Did I forget a setting etc? The process itself is working properly, new data is saved in th db or marked as deleted, according to the user action.
Thank you!This thread seems to be about checking the "include process success message" in the Action section of a Branch. I had the problem described and because of the hints here clicked that box in an unconditional branch and then was able to see in the #SUCCESS_MESSAGE# region the value assigned to apex_application.g_print_success_message once the branch took effect.
-
Page process: user defined error-message
hi to everyone!
i want to display a user-defined error-message, if for example a select in an anonymous PL/SQL block returns more than one row. i tried it with an user defined exception, but i get allways the success message... how can i do that?
thanks for your help.
bye,
christianHi,
In the exception handler of your PL/SQL process use this :-
apex_application.g_print_success_message := '<span style="color:red">Error message</span>';Regards
Paul -
Refresh page before branch/redirect to report download page
Hi Team,
I have to download a report.
For this I had made a Report region with template set to export:CSV.
I am branching to this page from another page say page4
When I redirect/branch to this page browser remains at page4, and prompts for download file occurs.
But my problem is that I have to display a message/some text in page4 before this prompt occurs.
Kindly suggest me on this.
Thanks and Regards,
Rajendra YadavHi,
From the Apex docs:
Selecting export: XML prevents the Application Express engine from rendering the page and dumps the content to an XML file.
I assume the same applies to export: CSV. So this is the expected behavior.
I see these options:
- Display the message in the same page (page4 in your example) using apex_application.g_print_success_message or some other method.
- Create an intermediate page that will contain only the message and code similar to the code below in the onload event. This code will call the report page:
// The time out is needed because onload may be triggered before
// all the page referenced files (CSSs, Javascripts etc) have been loaded
setTimeout('window.open("f?p=&APP_ID.:YOURREPORTPAGE:&SESSION.", "_self")', 1000);I personally find this type of solution ugly, maybe someone else has a better idea...
- A mix of those two: the branch will set a flag and navigate the same page, which will display the message and open the report page using the code above.
I hope this helps
Luis
Maybe you are looking for
-
Opeartion ADDDB - how does it work?
We have a bit of a weird problem with an employee - in essence he is getting the wrong overtime. On investigation it seems that the our Time Type Z060 has a value in it, when it shouldn't. There is a statement "ACTIO Z533" in our Time Schema which a
-
How to use glob search with the wildcard in command find?
How to use glob search with the wildcard in command find? I want to find any file its names begin with "readme" string using command find. Why the following command cannot work? $find /usr/share/doc -name readme* However, the following commands can w
-
Importing HDV footage - seems you don't want to use Premiere (?)
Hi everyone, and good morning. Well, after many great posts, and lots of help here, I think I realize something.... If you own a camcorder that does HDV footage ( like my Canon H20 ), you must use something other than Premiere to import your original
-
Installation/update/uninstalling problems
My CC Desktop app had recently updated and now every time I try and install/update/uninstall any CC program I get the same error! Exit Code: 36 Please see specific errors below for troubleshooting. For example, ERROR: DW069 ... -------------------
-
I am now running OS X Yosemite version 10.10.3 and have the APP Photos for all my photos. Can I now delete iPhoto and if so how does this needs to be done? Thanks, Gerard