Leave a comment

Closing all popups opened by a particular window


The following code is a cross-browser solution for closing all popup windows opened by a particular page:

 

CODE

–<– html>

–<–head>

—-<–script type=”text/javascript”>

 

<–/script>

<–/head>

<–body onunload=”closeChildWindows();”>

Click here to open another new window.

<–/body>

<–/html>

 

As long as you call the openNewWindow function to open your new windows, this will work.

 

 

 

U can use the function called :-

javascript:html_PopUp(’url’, ‘windowName’, 800, 600);

to open a pop up in Oracle APEX .

Leave a comment

convert the typed form input or typed text into the file in oracle apex


1) create an application with blank page .

2) ADD the Text area item (P1_ADD) .

3) Create a Button (Name:MAKEFILE, REQUEST:MAKEFILe)

Now when the Make file button is pressed you need to create a file and append the content of the P1_ADD to that file .

 

 

To do this , we need to create A Procedure as

 

create or replace procedure writefile(path varchar2,filename varchar2,content varchar2)

is

output_file utl_file.file_type;

begin

output_file := utl_file.fopen (path ,filename , ‘W’);

utl_file.put_line (output_file, content );

— utl_file.put_line (output_file,’second added here ‘);

utl_file.fclose(output_file);

 

–exception

— when others then null;

end;

/

 

 

 

Note: – the Path which we give here will be the relative , not absolute path .

 

EX:- if ur files need to be placed in E:\myfiles

then u need to do following .

 

 

Login to oracle :sys as sysdba;

 

create or replace directory MYDIR as “E:\myfiles”;

 

Now to make this accesible to your schema on which the application is created .

 

U need to

 

GRANT READ,WRITE ON DIRECTORY mydir TO myschema;

 

 

Incase u wanna create the directory with in the same schema then ur schema must have the rights to create the directory .

 

GRANT CREATE ANY DIRECTORY TO MYSCHEMA;

 

So , now u can create the directory using the same schema also .

 

 

Now on Page1 , create a process and call this procedure on the Click of the MAKEFILE button .

 

 

 

 

NOTE:- MYDIR needs to be in uppercase for sure.

Declare

l_n_fileno number;

 

begin

select demo_order_items_seq.nextval into l_n_fileno from dual;

writefile(‘MYDIR’,l_n_fileno||’.txt’,:P1_ADD);

end;

 

This will generate the files and name it using seq .

 

 

 

 

 

 

 

 

 

SEE refernces:-

 

http://www.cs.umbc.edu/portal/help/oracle8/server.815/a68001/utl_file.htm

 

 

http://forums.oracle.com/forums/thread.jspa?messageID=9169498�

 

http://www.adp-gmbh.ch/ora/plsql/utl_file.html

 

http://psoug.org/reference/utl_file.html

Leave a comment

Accessing the Environment variables in Oracle APEX


The OWA_UTIL package contains utility subprograms for getting the value of environment variables. Specifically the OWA_UTIL.GET_CGI_ENV function returns the value of CGI environment variables, like REQUEST_PROTOCOL, HTTP_HOST, SERVER_PORT and SCRIPT_NAME, this last one to get the mod_plsql cartridge and the database access descriptor name.

 

Usage:

 

view plaincopy to clipboardprint?

owa_util.get_cgi_env(‘REQUEST_PROTOCOL’)

owa_util.get_cgi_env(‘HTTP_HOST’)

owa_util.get_cgi_env(‘SERVER_PORT’)

owa_util.get_cgi_env(‘SCRIPT_NAME’)

 

 

You can quickly test these values creating a PL/SQL Dynamic Content region like this:

 

view plaincopy to clipboardprint?

BEGIN

HTP.p ( ‘Apex URL: ‘

|| OWA_UTIL.get_cgi_env (‘REQUEST_PROTOCOL’) || ‘://’

|| OWA_UTIL.get_cgi_env (‘HTTP_HOST’) || ‘:’

|| OWA_UTIL.get_cgi_env (‘SERVER_PORT’) || ‘/’

|| OWA_UTIL.get_cgi_env (‘SCRIPT_NAME’) || ‘/’

);

END;

 

 

Now to complete the URL you just need to append the well known f function with the right values. In case you have forget, here is the Apex f function URL Syntax:

view plaincopy to clipboardprint?

f?p=App:Page:Session:Request:Debug:ClearCache:itemNames:itemValues:PrinterFriendly

Leave a comment

Accessing the Parent Element on Child Page in Oracle Apex


function assign_value(vname, vid) { window.opener.document.getElementById(‘P2_VENDOR_NAME’).value = vname; window.opener.document.getElementById(‘P2_VENDOR_ID’).value = vid; window.opener.document.getElementById(‘P2_X’).value = vid; window.opener.document.getElementById(‘P2_VENDOR_NAME’).focus(); window.opener.doSubmit(‘LOAD_HEADER’); window.close(); } callinng popup from the parent page function popUp(URL) { day = new Date(); id = day.getTime(); eval(“page” + id + ” = window.open(URL, ‘” + id + “‘, ‘toolbar=0,location=0,statusbar=0,menubar=0,scrollbars=1’);”); }

Leave a comment

Oracle APEX by nandini thakur


Some content of Oracle apex may be help full for the needy

Leave a comment

Report on Function Returning the Query in Oracle apex


1)Create A page and Create a basic report on the page with the option of the source as the sql query (PLSQL function body returning the sql query).

2) Create an function which will take the table name as the input and return the query as the o/p.

create or replace function “QUERY_FOR_REPORT”

(table_name in VARCHAR2 default ‘EMP’)
return VARCHAR2
is
l_query varchar2(2000);
begin
l_query:=’select * from ‘||table_name;

return l_query;
end;

3)

Call this function on the report as following .

BEGIN
RETURN QUERY_FOR_REPORT(‘AGENDA ‘ ||’;’);
END;

4) to check the o/p pf your function you can  run the same function on the sql workshop and check it.

 

Declare

l_r varchar(200):=QUERY_FOR_REPORT(‘AGENDA ‘ ||’;’);

Begin
dbms_output.put_line(l_r);

END;

 

 

5) now runt the page , it displays the report .

 

 

 

Leave a comment

DataLoading Application in Oracle APEX


Dataloading application in apex

 

http://www.oracle.com/webfolder/technetwork/tutorials/obe/db/apex/r41/dataload/dataload.htm