Variables in Apex

Hi all,
I have a little problem. I don't know how to define variables and use them again in APEX
For exemple :
I want to display which week of the year we are on an HTML Region
the query is simple : select to_char(sysdate,'IW') from dual;
But How can I do that ?
Someone can help ?
Thank you

Moun wrote:
Hi all,
I have a little problem. I don't know how to define variables and use them again in APEXCreating and managing "variables"—page and application items in APEX—in session state is a very basic technique that is covered in the +2 Day Developer's Guide+.
If you have not completed this tutorial you are recommended to do so.
For exemple :
I want to display which week of the year we are on an HTML Region
the query is simple : select to_char(sysdate,'IW') from dual;
But How can I do that ?Create an APP_WEEK application item, set it using <tt>to_char(sysdate,'IW')</tt> in an application computation, and reference it in the HTML region source using a static text substitution:
&APP_WEEK.

Similar Messages

  • How to create a session variable in Apex?

    Hello colleagues,
    Is there someone do know how to create a session variable in Apex?
    How to get them?
    Thanks
    Best Regards

    Hello,
    What do you mean by 'session variable'? You mean something that stores the value int he users session state?
    I really recommend reading the 2-Day Developer guide documentation, there is a complete section on session state -
    http://download.oracle.com/docs/cd/E10513_01/doc/appdev.310/e10499/concept.htm#CIHCFHBD
    Hope this helps,
    John
    Blog: http://jes.blogs.shellprompt.net
    Work: http://www.apex-evangelists.com
    Author of Pro Application Express: http://tinyurl.com/3gu7cd

  • APEX: Declare global variable in APEX

    Hello All,
    Can anyone tell me how to declare global variable in Process(Pl/sql code) in Oracle APEX.
    Thanks,
    Jiten

    There is nothing like Global Variable that can be declared in Process in Apex.
    Look up Shared Components > Application Item. Maybe that is something that meets your requirement.
    Alternate, use Page 0 items.
    Regards,

  • Pass variable from apex to shell script

    Hi,
    i am able to use apex button to run a db scheduler job and use the the job to run an OS bash script, but don't know how to pass an variable to the script from apex.

    Hi,
    Thansk for the reply.
    My scenario is
    1. Apex page 1: Store List Report, click the store you want to process, the selected store id and store name will be passed to apex page 2 automatically.
    2. Apex page 2: Show the store ID and Store Name, once confirm click a button on the screen. I already created dynamic action of the button to run a bash script in OS via dbms_scheduler.
    My issue is i don't know how to get the store id and pass it to the bash script through dbms_scheduler.
    Regards
    Lion

  • Using pipelined functions with bind variables in Apex...

    Hy all:
    I have a table which has about 10 million records and it is hanging up the system when it is trying to retrieve the data from that table... so what I have done is I created a pripelined
    function and then trying to retrieve data using an SQL statement ... when I try to use a bind variable to filter by the date and location it is binding according to the location
    but not by date ... can anyone help me in this please!!
    Help greatly appreciated !
    Thanks in advance !

    Hi Denes:
    Create or replace type ohe1 as object (
    IMLITM NCHAR(50), IMAITM NCHAR(50), IMDSC1 NCHAR(60), COUNCS NUMBER(22), LIPQOH NUMBER(22),
    LIMCU NCHAR(24), LILOCN NCHAR(40), LILOTN NCHAR(60), LILOTS NCHAR(2), IOMMEJ NUMBER(22))
    CREATE OR REPLACE TYPE OHE AS TABLE OF Ohe1
    CREATE OR REPLACE FUNCTION GET_ohe
    return OHE PIPELINED
    IS
    m_rec ohe1:= ohe1 (NULL,NULL,NULL,0,0,NULL,NULL,NULL,NULL,0);
    begin
    for c in (select f1.LITM LITM, F1.AITM AITM, F1.DSC1 DSC1, F5.UNCS UNCS,
    F21.QOH QOH, F21.MCU MCU, F21.LOCN LOCN, F21.LOTN LOTN, F21.LOTS LOTS,
    F8.MEJ MEJ FROM F1 F1, F2 F2, F21 F21, F5 F5, F8 F8
    WHERE (F5.EDG='07') AND (F21.QOH != 0) AND F2.IBITM = F1.IMITM
    AND F21.ITM = F2.ITM AND F21.ITM = F5.ITM AND F21.MCU = F5.MCU
    AND F21.MCU = F2.MCU AND F21.LOTN = F8.LOTN AND F21.MCU = F8.MCU)
    loop
    m_rec.LITM:=c.LITM;
    m_rec.AITM:=c.AITM;
    m_rec.DSC1:=c.DSC1;
    m_rec.UNCS:=c.UNCS;
    my_record.QOH:=c.QOH;
    my_record.MCU:=c.MCU;
    my_record.LOCN:=c.LOCN;
    my_record.LOTN:=c.LOTN;
    my_record.LOTS:=c.LOTS;
    my_record.MEJ:=c.MEJ;
    PIPE ROW (my_record);
    end loop;
    return;
    end;
    select LITM , AITM , DSC1 , UNCS*.0001 UNCS, QOH*.0001 QOH, (UNCS*.0001)*(QOH*.0001) AMOUNT,
    MCU MCU, LOCN LOCN, LOTN LOTN, LOTS LOTS, jdate(DECODE(MEJ,0,100001,MEJ)) MEJ FROM
    TABLE (GET_ohe)
    WHERE trim(LIMCU)= TRIM(:OHE_BRANCHID)
    AND (jdate(DECODE(MEJ,0,10001,MEJ)) >=:FROMEXPDT
    AND jdate(DECODE(MEJ,0,10001,MEJ)) <=:TOEXPDATE)
    The MEJ is a julian date and I am trying to convert it into a date ..... using the function jdate! and the pipelined function is created without any errors
    and I am able to get the data with correct branch location bind variable but only problem is it is not binding the date filters in the sql.....
    Thanks
    Edited by: user10183758 on Oct 16, 2008 8:17 AM

  • Apex Global Variable like D2K

    HI,
    Previously my application was develop in d2k6i where i use global variable to keep user_id available in every forms...
    is it posbile to declare global variable in Apex ?
    Thanks
    Engr.M.K Chowdhury

    Just to extend Andy's point a little further, you may want to look at some of the built in Substitution Strings that APEX offers you right out of the tin:
    http://download.oracle.com/docs/cd/E14373_01/appdev.32/e11838/concept.htm#BEIFGFJF
    You may find that Oracle provide you with the global value you need but follow Andy's advice for creating your own.
    Duncs

  • How do we handle multiple items in Apex?

    Hi All,
    I have a requirement in to process the fileds data.I have a item by name as "Platts Lead1 to Platts Lead10" of type list items.
    By assuming end user can select entire fileds or we can first five items i.e "Platts Lead1 to Platts Lead5" and then insert into data base.
    How we can hanle this scenerios in Apex process..
    Thanks,
    Anoo..

    Anoo wrote:
    I have a requirement in to process the fileds data.I have a item by name as "Platts Lead1 to Platts Lead10" of type list items.
    By assuming end user can select entire fileds or we can first five items i.e "Platts Lead1 to Platts Lead5" and then insert into data base.
    How we can hanle this scenerios in Apex process..There is a dedicated Apex forum - please use it to ask Apex related questions.
    As for dealing with variable items - Apex has a number of global arrays/collections that can be used. The Apex Item API enables you to create a dynamic list of items (as check boxes, text boxes, list boxes, hidden text fields, etc). Where user supplied data for variable item lists are available via global/static PL/SQL arrays.
    Please have a look at the API, close your question here, and re-ask it (with as much specific details as possible) in forum {forum:id=137}.

  • Variable usage cheat sheet

    I would like to have a cheat sheet that explains how to reference the different types of variables in Apex.
    When and how do you use
    1. Substitution variables (&myvar)
    2. Bind variables (:myvar)
    3. Pound? variables (#MYVAR#)
    Could anyone please provide me with a clear guideline for this?
    Thanks!

    RTF?? Read The Fabulous Manual??
    Thank you,
    Tony Miller
    Webster, TX
    If vegetable oil is made of vegetables, what is baby oil made of?
    If this question is answered, please mark the thread as closed and assign points where earned..

  • Pass parameter to apex page via the URL

    Hi, I need to pass a parameter into a page that will be used in a query inside a report region,
    e.g report region query is
    select link_id, page_id, menu_parent_id, link_text, link_url
    from portal_pages
    where page_id = :page_id
    So the page will display different links depending on what value is passed to the page in the variable.
    I know with normal URL syntax it would be something like
    http://www.domain.com/page.html&page_id=1 (where page_id is a hidden variable in apex)
    but how do I do this with an apex page like :-
    http://host:port/pls/apex/f?p=123:9 <what goes here ? and what goes in the page for it to work>
    Any help appreciated - noob to Apex
    Thanks
    Phil.

    If your item to be used in the url is P1_Page_Id, the
    url should be something like:<br>
    http://host:port/pls/apex/f?p=123:9:page_id:&P1_Page_I
    d.
    Thanks for comments, understand the syntax of the apex URLs now, got the item sorted in the page now, all working.

  • Using :APP_ID in the sql query in apex

    Hi All,
    I am facing problem while using :APP_ID in the query for populating the Select list in apex.
    can any one suggest me how to use :APP_ID in the query. It is working fine in URL making.... in the javascript codes.
    And one more thing please put up the list of Global variable, Environment Variables in apex. like :APP_USER, :APP_ID
    Thanks in Advance,
    Santhosh Tirunahari

    Hello Santhosh,
    An example using APP_ID:
    select WORKSPACE, APPLICATION_ID, APPLICATION_NAME, LIST_NAME
    from APEX_APPLICATION_LIST_ENTRIES
    where APPLICATION_ID =:APP_IDGreetings,
    Roel
    http://roelhartman.blogspot.com/
    You can reward this reply by marking it as either Helpful or Correct ;-)

  • Query with bind var created under apex to generate xml data

    Hi all;
    BiP: 10.1.3.4
    Apex: 4
    DB 10G
    Goal: want to generate a report by running a query with bind variables under apex.
    problem: when attempted to create a query under shared components in apex, at the downloading xml data stage, I always get "no data found" eror. Thus I can't save xml data for further report work. This only occurs when bind var involved. I have tticked "incl. session variables" and added the item but to no avail.
    Does anyone know how to do this and get the xml data to recive the bind variable ?
    Thanks.
    lulu

    To get the xml data, sql query has to return something. Why the sql is not returning anything can be better investigated outside the BI Publisher with special tool like SQL Developer or TOAD. There you have to run your query and make it working. One of the steps would be to try the sql without the parameter, see what data it brings back and go from there. One of possibilities why the parameter kills the output may be the NULL values involved, but you need to try the sql outside the BIP first.

  • Create Global Variable

    Hello developers,
    I need to create a global bind variable, which i can fill with a return value of a select statement. Can someone tell me how to do it, or send me a link, where global bind variables in APEX are explained

    Hi,
    Thanks for your information.
    >
    This works, when the condition of P0_END_TIME is "always", but doesn't work, hen it's "never".
    >
    Of course the conditional display for the other item will not work, if the conditional display for the P0_END_TIME is set as Never.
    Do you want to hide the item P0_END_TIME on the page where the other item is displayed?
    If yes set the conditional display as:
    Condition Type: Current Page is NOT in Expression 1 OR Current Page is in Expression 1(Use the appropriate one! )
    Expression 1: Comma delimited list of Page Numbers
    OR
    Do you want to hide the item P0_END_TIME for all the pages of the application?
    Then set the item attributes for P0_END_TIME:
    Display as: Hidden
    Value Protected: No
    Hope it helps!
    Regards,
    Kiran

  • Getting query results from a PL/SQL procedure

    Hi! So, I’m a little stumped and I can’t seem to find the answer to what I believe is probably a simple question…
    So, here goes… I have a big ol’ union query that I use to create a report on a page, it’s about 25k – not over the 32k limit, but fails to be able to compile every time (I always get a 400 – Bad Request error). I’m not sure why this is happening, but I can remove a union statement and it compiles just fine – so it has something to do with the size of the query. ANYWAY – I’ve resolved that I should put this bad boy into the database as a stored procedure and just call it from Apex, my problem is I can’t figure out quite how to do this with variables, etc.…
    Instead of giving you my whole big query, I’ll use the emp table as the concept is the same:
    Say we have a query that creates a report on a page:
    select empno, ename, job, mgr, hiredate, sal, comm, deptno
    from emp
    where job = :P_JOB
    and hiredate >= :P_HIREDATE;
    How would I take this query, create it as a stored procedure on the db, pass the variables from Apex and return the query result set from the stored proc as a report?
    I really appreciate any help on this!
    Best,
    Gilcrest

    Hi Gilcrest,
    You should create the query as a View and use the view name and the WHERE clause in the report's sql source.
    Andy

  • LinkListExplorer iview BackGround Image path not working

    HI All ,
    As i am using Layout set LinkListExplorer for few external links , when i am giving image name for eg growth.jpg in  background image path,  which is placed at /etc/public/mimes/images it is not showing anything , the same is working for NewsBrowser Layout set  . I have tried many thing all possiblities but no success .
    Pls help me in this regard.
    Shwetang saxena

    Hi Vedant,
    APEX only replaces the #WORKSPACE_IMAGES# variable within APEX itself. This is quite logical, because what you see in the APEX developer space is generated by PL/SQL from the database, so APEX can change what it wants. APEX can't access the files however, that's logical to because APEX would need premissions on the server and an Oracle directoryto start doing changes to files.
    So if you want to point to the image directory in the CSS file you need to provide the full path.
    Regards,
    Joni

  • Urgent Application Express response

    Hi all:
    I am developing an application using APEX, this application will be requested from an external web application.
    The http request of the external web application will add some variables which will include users information that I will need to to use in my APEX to determine the what to display on the the page.
    My problem is how do I do this, it appears that the REQUEST variable of APEX only works when APEX is already running for the user and will not display a thing upon the first request of the external application.
    Please help me

    Hello,
    >> The http request of the external web application will add some variables which will include users information that I will need to to use in my APEX
    The f?p syntax - http://download.oracle.com/docs/cd/E14373_01/appdev.32/e11838/concept.htm#BEIJCIAG – allows you to set the APEX items you need. Bear in mind that this URL is in clear text, and public. You shouldn’t use it for sensitive data.
    Regards,
    Arie.
    &diams; Please remember to mark appropriate posts as correct/helpful. For the long run, it will benefit us all.
    &diams; Forthcoming book about APEX: Oracle Application Express 3.2 – The Essentials and More

Maybe you are looking for

  • Why would the browser preview display look different than what I am seeing in the design view? Pls help!

    When working with accordion panels, when I first insert the widget it looks fine, then I begin customizing the content and then the Preview display does not look the same as the Design display. For instance, in the design display the panel aligns wit

  • Duplicate IR-L document.

    Hi We are in SAP 4.7. Once the Invoive verification document is posted for all the items for a PO with MIGO system is allowing to post one more document for the same PO. We have checked check duplicate invoice in teh vendor master which should preven

  • Keynote exporting to FLASH will not run on browsers

    I have created several short keynote files that were then exported to Flash so that they can be viewed on an HTML page created by dreameweaver. However, after exporting them to a swf file and then importing the flash file into an html page all I get

  • Apple USB Ethernet Adapter and VLAN??

    Bought the Apple USB Ethernet Adapter today because my built in ethernetport on my MBP stopped working. What I know I need to replace the motherboard to have it fixed, so I thought the USB adapter could be useful until then. But, it didn't work! I on

  • Display query on Web from Query Designer in BI 7.0

    Hi, I am trying to see my report in the web like how I do in BW 3.5. The sytem taking me to the Browser. But the page is not displayed. The normal cannot display HTML page. I think I need to configure BEx broadcaster for this. Can anyone help me on h