Apex_util.prepare_url

Hi
I have this sql, and need to add cs to the url... someone there know how I use apex_util.prepare_url() in a sql statement?
My sql statment:
http://vels.dk/tmp/sql.jpg
(I have tryed to pass the code here, but it is not showed correct)

See Re: Link in report ?
Maarten

Similar Messages

  • APEX_UTIL.PREPARE_URL does not work across workspaces?

    We are running ApEx 4.1.1 on Oracle 11g.
    I am trying to call an application in another workspace and am using APEX_UTIL.PREPARE_URL in a hidden item and then a button with REDIRECT TO URL using javascript:popUp2 which uses the hidden item (the returned value of the PREPARE_URL. The code works fine if I am in the same workspace and a checksum is returned:
    APEX_UTIL.PREPARE_URL('f?p=9002:2:&SESSION.::NO::P2_CALLING_APP_ID,P2_CALLING_APP_NAME:&APP_ID.,&G_APP_NAME.&c=STU_WS','SESSION');
    returns:
    f?p=9002:2:1400894538262901::NO::P2_CALLING_APP_ID,P2_CALLING_APP_NAME:9001,FRD_MASTER_BANSECR&c=STU_WS&cs=3190FB9A8CC967E5B3CED03460DF6F291
    I can press the button and app 9002 opens in a new window.
    When I try the same code in an application in another workspace, no checksum is returned:
    APEX_UTIL.PREPARE_URL('f?p=9002:2:&SESSION.::NO::P2_CALLING_APP_ID,P2_CALLING_APP_NAME:&APP_ID.,&G_APP_NAME.&c=STU_WS','SESSION');
    returns:
    f?p=9002:2:8288147979401::NO::P2_CALLING_APP_ID,P2_CALLING_APP_NAME:112,Testing_Template&c=STU_WS
    and I get the error:
    Error     Session state protection violation: This may be caused by manual alteration of a URL containing a checksum or by using a link with an incorrect or missing checksum.
    I have also tried it without the workspace '&c=STU_WS' and explicitly passing the parameters, but no checksum is returned.
    APEX_UTIL.PREPARE_URL(p_url => 'f?p=9002:2:&SESSION.::NO::P2_CALLING_APP_ID,P2_CALLING_APP_NAME:&APP_ID.,&G_APP_NAME.',p_checksum_type => 'SESSION')
    If I do not try to pass any parameters, no checksum is produced, but the button successfully opens app 9002 in a new window:
    APEX_UTIL.PREPARE_URL('f?p=9002:4:&SESSION.::NO::&c=STU_WS','SESSION');
    returns:
    f?p=9002:4:8288147979401::NO:::&c=STU_WS
    Again, the above code successfully opens app 9002 in a new window. In fact, when not passing parameters to app 9002, I would not seem to need to use PREPARE_URL.
    BUT. I do need to pass the calling app id and the calling app name to app 9002, because 9002 looks up information about the calling app. Since, I must pass parameters, I must use PREPARE_URL, and it does not seem to work when you call it for an app in a different workspace.
    Given all of the above, I have found a kludge. I call PREPARE_URL using the APP_ID of the current app and then replace that APP_ID with 9002.
    replace(APEX_UTIL.PREPARE_URL('f?p=&APP_ID.:2:&SESSION.::NO::P2_CALLING_APP_ID,P2_CALLING_APP_NAME:&APP_ID.,&G_APP_NAME.&c=STU_WS','SESSION'),
    'f?p=&APP_ID.:2','f?p=9002:2')
    returns:
    f?p=9002:2:8288147979401::NO::P2_CALLING_APP_ID,P2_CALLING_APP_NAME:112,Testing_Template&c=STU_WS&cs=33B2BB2ECFE3555198CE3325CCF9F67B8
    And the button opens app 9002 just fine.
    Is there anyway to get PREPARE_URL to work with apps in another workspace? What am I missing? Is there a better way than the kludge I came up with?
    A little more information: my app 9002 is a help & info for ApEx DBAs and Developers. It is my attempt at code reuse. Calls to 9002 are in a master template. I can continually update and change the help in 9002 without having to update the apps that call it.
    Thanks for your help,
    Chris

    lewisc3 wrote:
    We are running ApEx 4.1.1 on Oracle 11g.
    I am trying to call an application in another workspace and am using APEX_UTIL.PREPARE_URL in a hidden item and then a button with REDIRECT TO URL using javascript:popUp2 which uses the hidden item (the returned value of the PREPARE_URL. The code works fine if I am in the same workspace and a checksum is returned:
    APEX_UTIL.PREPARE_URL('f?p=9002:2:&SESSION.::NO::P2_CALLING_APP_ID,P2_CALLING_APP_NAME:&APP_ID.,&G_APP_NAME.&c=STU_WS','SESSION');
    returns:
    f?p=9002:2:1400894538262901::NO::P2_CALLING_APP_ID,P2_CALLING_APP_NAME:9001,FRD_MASTER_BANSECR&c=STU_WS&cs=3190FB9A8CC967E5B3CED03460DF6F291
    I can press the button and app 9002 opens in a new window.
    When I try the same code in an application in another workspace, no checksum is returned:
    APEX_UTIL.PREPARE_URL('f?p=9002:2:&SESSION.::NO::P2_CALLING_APP_ID,P2_CALLING_APP_NAME:&APP_ID.,&G_APP_NAME.&c=STU_WS','SESSION');
    returns:
    f?p=9002:2:8288147979401::NO::P2_CALLING_APP_ID,P2_CALLING_APP_NAME:112,Testing_Template&c=STU_WS
    and I get the error:
    Error     Session state protection violation: This may be caused by manual alteration of a URL containing a checksum or by using a link with an incorrect or missing checksum.
    I have also tried it without the workspace '&c=STU_WS' and explicitly passing the parameters, but no checksum is returned.
    APEX_UTIL.PREPARE_URL(p_url => 'f?p=9002:2:&SESSION.::NO::P2_CALLING_APP_ID,P2_CALLING_APP_NAME:&APP_ID.,&G_APP_NAME.',p_checksum_type => 'SESSION')
    If I do not try to pass any parameters, no checksum is produced, but the button successfully opens app 9002 in a new window:
    APEX_UTIL.PREPARE_URL('f?p=9002:4:&SESSION.::NO::&c=STU_WS','SESSION');This is wrong because you are passing string SESSION for url_charset parameter, that's why id is not adding any checksum
    See this http://docs.oracle.com/cd/E23903_01/doc/doc.41/e21676/apex_util.htm#AEAPI160
    returns:
    f?p=9002:4:8288147979401::NO:::&c=STU_WS
    Again, the above code successfully opens app 9002 in a new window. In fact, when not passing parameters to app 9002, I would not seem to need to use PREPARE_URL.
    BUT. I do need to pass the calling app id and the calling app name to app 9002, because 9002 looks up information about the calling app. Since, I must pass parameters, I must use PREPARE_URL, and it does not seem to work when you call it for an app in a different workspace.
    Given all of the above, I have found a kludge. I call PREPARE_URL using the APP_ID of the current app and then replace that APP_ID with 9002.
    replace(APEX_UTIL.PREPARE_URL('f?p=&APP_ID.:2:&SESSION.::NO::P2_CALLING_APP_ID,P2_CALLING_APP_NAME:&APP_ID.,&G_APP_NAME.&c=STU_WS','SESSION'),
    'f?p=&APP_ID.:2','f?p=9002:2')
    returns:
    f?p=9002:2:8288147979401::NO::P2_CALLING_APP_ID,P2_CALLING_APP_NAME:112,Testing_Template&c=STU_WS&cs=33B2BB2ECFE3555198CE3325CCF9F67B8
    And the button opens app 9002 just fine.
    Is there anyway to get PREPARE_URL to work with apps in another workspace? What am I missing? Is there a better way than the kludge I came up with?
    A little more information: my app 9002 is a help & info for ApEx DBAs and Developers. It is my attempt at code reuse. Calls to 9002 are in a master template. I can continually update and change the help in 9002 without having to update the apps that call it.
    Review all above API calls and make sure you pass right parameters

  • Apex_util.prepare_url from PL/SQL (outside APEX)

    Hello there,
    I have to create a job that sends emails with a link to a page with SSP actived and that requires authentification.
    I've read those threads from Dan and Omar and I wonder if this is still possible in APEX 4.2.1?
    Re: apex_util.prepare_url outside of ApEx
    Create APEX session context from outside APEX (plsql)
    My procedure generate the link with the checksum, but when I try to access the page I got an error :
    •is_internal_error: true
    •apex_error_code: APEX.SESSION_STATE.SSP_VIOLATION2_FOR_DEVELOPERS
    •error_backtrace: ----- PL/SQL Call Stack -----
      object      line  object
      handle    number  name
    0x69e9c2e8       548  package body APEX_040200.WWV_FLOW_ERROR
    0x69e9c2e8       599  package body APEX_040200.WWV_FLOW_ERROR
    0x69e9c2e8       903  package body APEX_040200.WWV_FLOW_ERROR
    0x6e5ff258      6025  package body APEX_040200.WWV_FLOW
    0x73cbd318       249  procedure APEX_040200.F
    0x6bdb2dd0        31  anonymous blockHere is my proc (code found in Omar's thread).
    Maybe I'm missing something.
    CREATE OR REPLACE procedure testInitApexFromOutside
          ( i_app_id     in number
          , i_page_id      in number
          , i_apex_user    in varchar2
          ) is
        v_cgivar_name  owa.vc_arr;
        v_cgivar_val   owa.vc_arr;
        v_workspace_id NUMBER;
        v_app_id       number;
          BEGIN
        -- set up cgi environment
        htp.init;
        v_cgivar_name(1) := 'REQUEST_PROTOCOL';
        v_cgivar_val(1)  := 'HTTP';
        owa.init_cgi_env
          ( num_params => v_cgivar_name.count
          , param_name => v_cgivar_name
          , param_val  => v_cgivar_val
        -- load apex IDs by application name
        SELECT workspace_id,
               application_id
        INTO v_workspace_id,
             v_app_id
        FROM apex_applications
        WHERE application_id=i_app_id;
        -- set up apex workspace
        wwv_flow_api.set_security_group_id(v_workspace_id);
        -- set up apex session vars
         apex_application.g_instance     := wwv_flow_custom_auth.get_next_session_id;
        apex_application.g_flow_id      := v_app_id;
        apex_application.g_flow_step_id := i_page_id;
        -- "login"
        apex_custom_auth.define_user_session
          ( p_user       => i_apex_user
          , p_session_id => apex_application.g_instance
        wwv_flow_custom_auth_std.post_login
          ( p_uname      => i_apex_user
          , p_session_id => apex_application.g_instance
          , p_flow_page  => apex_application.g_flow_id
                         || ':'
                         || apex_application.g_flow_step_id
          -- set array of protected page IDs for session state protection
         apex_application.g_protected_page_ids(1) := '1500';    -- this establishes page 1500 as an SSP-protected page
        dbms_output.put_line(APEX_UTIL.PREPARE_URL('f?p='||i_app_id||':'||i_page_id||':::NO:1500:P1500_PEV_SEQ_NO:18137',2));
    end testInitApexFromOutside;And the result:
    f?p=128:1500:::NO:1500:P1500_PEV_SEQ_NO:18137&cs=3B3D5905A7DDBCB5520E8F88885169CAC
    Thanks for your help,
    Lucien

    See Re: Link in report ?
    Maarten

  • Apex_Util.Prepare_URL  Question due to Apex Util Advisor msg

    Hi,
    I have the following code in an SQL statement within an IRR:
    APEX_UTIL.PREPARE_URL( p_url => 'f?p=' || v('APP_ID') || ':398:'||v('APP_SESSION')||'::NO:398:P398_IDOBJ:||VIMG_SEARCH.IDOBJ:', p_checksum_type => 'SESSION') FullImg,
    And it works as expected. However when i run the Apex Util Advisor I get the following:
    Attribute     Region Source (Identifies the source of the region, reference Region Source Type)
    Check     V Function used in SQL Statements
    Category     Performance
    Message     Contains V/NV/DV function call in SQL statement (can be a performance problem).
    Do I need to worry about this ? or should I change the syntaxt within the APEX_UTIL.PREPARE_URL parameters ?
    Thank you
    Daniel

    In SQL (and PL/SQL blocks within APEX) the bind variable notation should be used:
    APEX_UTIL.PREPARE_URL( p_url => 'f?p=' || :APP_ID || ':398:'||:APP_SESSION||'::NO:398:P398_IDOBJ:||VIMG_SEARCH.IDOBJ:', p_checksum_type => 'SESSION') FullImg,The <tt>v(...)</tt> notation is for use in database PL/SQL program units called from APEX.

  • APEX_UTIL.PREPARE_URL with checksum

    Hi all,
    sorry to bring up this topic up again.
    I was trying to do what was discussed in the following thread, but it just couldn't work for me.
    APEX_UTIL.PREPARE_URL 0- cecksum parameter
    The link in my email did not have the checksum parameter though i have run it over the APEX_UTIL.prepare_url function
    I verify this using the toad debugger.
    and I use the following sql to test as well
          select apex_util.prepare_url('f?p=137:99::5:NO:5:P5_REQUESTSEQ:2010100246',null,3) from dualit only return that string back without any checksum parameter.
    Am I doing this wrongly?
    Appreciate any input.
    Thanks.
    -Joel

    Hi Jari,
    Should i have session id because the link will be used by other people whom is the recipient of the email?
    I was following the steps in the other thread I mentioned.
           So if the link you want them to use is f?p=100:1:::NO:RP:P1_X,P1_Y:abc,def and your new public page is 2, send them this link instead:f?p=100:2::1:NO:RP:P1_X,P1_Y:abc,def.Without the SSP, the redirection and joining existing session are working. So I guess order of the parameter in the URL is correct.
    Thanks
    -Joel

  • Trouble getting  apex_util.prepare_url to produce checksum

    Session State Protection is enabled in both apps & Page attribute "Page access protection" is set to "Arguments Must have Checksum"
    Does not give checksum...
    http://apex.oracle.com/pls/apex/f?p=34780:3
    I even went into SSP and had it enabled for all page items and pages and still doesn't make a difference.
    Select 'x', APEX_UTIL.PREPARE_URL ('f?p='||:APP_ID || ':1::' || :APP_SESSION || '::::P1_EMPNO:' ) employee_link from dual;
    Different app Same Query... Provices checksum
    http://apex.oracle.com/pls/apex/f?p=39900:3
    Select 'x', APEX_UTIL.PREPARE_URL ('f?p='||:APP_ID || ':1::' || :APP_SESSION || '::::P1_EMPNO:' ) employee_link from dual;
    Any Ideas?
    Justin
    workspace:epic

    OK.. seems to me that:
    Justin Patterson wrote:
    Does not give checksum...
    http://apex.oracle.com/pls/apex/f?p=34780:3
    SSP Screenshot
    http://tinypic.com/r/k4fjvc/7
    This has no page 1, therefore no checksum would be generated ;).
    >
    Different app Same Query... Provices checksum
    http://apex.oracle.com/pls/apex/f?p=39900:3
    SSP Screenshot
    http://tinypic.com/r/5fnst2/7
    This has page 1, therefore checksum is generated.
    Also, the app_session is in the wrong place.
    Ta,
    Trent

  • APEX_UTIL.PREPARE_URL cannot produce checksum

    Hi, Guys:
    I tried to use APEX to generate checksum for url, but it does not work, no checksum is generated. I was confused. Culd anyone tell me what is the problem? here is my code:
    DECLARE
        l_url varchar2(2000);
    BEGIN
        :P1_TF_CHECKSUM:= APEX_UTIL.PREPARE_URL('f?p='||:APP_ID||':12:'||:APP_SESSION||'::NO::P12_ACE_ID:xyz', p_checksum_type => 'SESSION');
    END;You can find my application on apex.oracle.com:
    workspace: LIAPEXTEST
    acc:[email protected]
    pwd:lxus2000
    app_ID: 44976
    Thanks!

    Hi,
    My understanding is that the checksum will only be generated if there is some sort of session state protection enabled, on the items you are trying to set through the URL. (Probably if the page has some sort of protection as well)
    For example, the text item you have on page 1 has the security setting: "Checksum required - session level".
    So I copied your page process, and attempted to set that page item in the process - now you will see the checksum generated.
    On the original process (currently disabled), for which you are setting an item that doesn't exist, and thus has no session state protection, therefore no checksum is needed.

  • Apex_util.prepare_url within a select statement

    APEX Version: 3.1.2.00.02
    Need help with embedding APEX_UTIL.PREPARE_URL in select statement. Unable to reference column name as a bind variable...or it allows as in code below, but no values are included in the URL. Using PREPARE_URL so checksum is created.
    URL created:*
    https://.../f?p=108:90:623968923157010::NO::P90_RID:&cs=3CB12F3B467B3989B51377487817BDB08
    Note: href >> replaced with >> hrf
    declare
       q           varchar2(32767);      -- query
       w           varchar2(4000) ;      -- where clause
       we          varchar2(1) := 'N';  -- identifies if where clause exists
    begin
       q :=  'select "RID", '||
             '       "EMPLOYEE_NO", '||
             '       InitCap(first_name)||
             '||''' '''||
             '||InitCap(last_name) as "Name", '||
             '       "HIRE_DATE", '||
             '       "JOB_TITLE", '||
             '       CASE '||
             '          WHEN CORRECTION_IND = 'X' '||
             '             THEN ''<a hrf="' ||
    apex_util.prepare_url('f?p='||:APP_ID||':90:'||:APP_SESSION||'::'||:DEBUG||'::P90_RID:'||:RID) ||
             '">Correction</a>'' '  ||
             '          ELSE    NULL '||  
             '       END CORRECTED '||
             '  from "#OWNER#"."EMPLOYEE_TABLE" ';
       if :P28_FIRST_NAME IS NOT NULL
          then
             w := w || ' AND first_name LIKE UPPER(:P28_FIRST_NAME||'||'''%''' ||')' ;
             we := 'Y';
       end if;
       if :P28_LAST_NAME IS NOT NULL
          then
             w := w || ' AND last_name LIKE UPPER(:P28_LAST_NAME||'||'''%''' ||')' ;
             we := 'Y';
       end if;
       if we = 'Y'
          then q := q || w;
       end if;
    return q;
    end;Edited by: JSandoval on May 25, 2011 1:03 PM

    I think that the problem is that the function apex_util.prepare_url is executed building the "q" variable, not during query execution. (you have to try to quote it ...)
    I often use the "Query from function".
    There a couple of things that helps me:
    - I always put in the page an item PXX_SHOW_SQL(checkbox) visible only to administrator (a user setting in my application...).
    Before the "return q" put a htp.p(q) if this Item is not null. So you can see the actual SQL (often helps reformattig the output with SqlDeveloper)
    - I'm became crasy tring to quote complex query ... Now I write the query code in a TABLE
    Example AUXSQL(APP_ID number,APP_PAGE number, PRG number, sql VARCHAR2(4000))
    More "PRG" if more than 4000 chars. (I start in this way, but someone use CBLOB ...)
    I find this very usefully!!
    Thanks
    Stefano Corradi

  • APEX_UTIL.GET_BLOB does anyone know how to calculate the checksum?

    Hi!
    Does anyone know how to calculcate the checksum for the APEX_UTIL.GET_BLOB-Link?
    <a href="apex_util.get_blob?s=2040766138999284&a=500&c=2963523354500419&p=7030&k1=1841200&k2=&ck=E369F782D77061F0FEAC0BB42EC5E63B&rt=IR">
      <img width="30px" src="wwv_flow_file_mgr.get_file?p_security_group_id=2444012387079848&p_fname=download.png">
    </a>the "ck" parameter: ck=E369F782D77061F0FEAC0BB42EC5E63B
    Thx!
    PS: Yes I know the APEX_UTIL.GET_BLOB_FILE_SRC-Function, but I like the easy way, that's why I am using APEX ;)

    What is your apex version??
    DF777 wrote:
    Hi!
    Does anyone know how to calculcate the checksum for the APEX_UTIL.GET_BLOB-Link?Try wraping your above API call with APEX_UTIL.PREPARE_URL
    http://docs.oracle.com/cd/E37097_01/doc/doc.42/e35127/apex_util.htm#CDEIBCJD
    <a href="apex_util.get_blob?s=2040766138999284&a=500&c=2963523354500419&p=7030&k1=1841200&k2=&ck=E369F782D77061F0FEAC0BB42EC5E63B&rt=IR">
    <img width="30px" src="wwv_flow_file_mgr.get_file?p_security_group_id=2444012387079848&p_fname=download.png">
    </a>the "ck" parameter: ck=E369F782D77061F0FEAC0BB42EC5E63B
    Thx!
    PS: Yes I know the APEX_UTIL.GET_BLOB_FILE_SRC-Function, but I like the easy way, that's why I am using APEX ;)you mean that this api is not easy??

  • Interactive Report Performance With Conditional Link

    Apex 3.2
    I have a interactive report.
    The underlying sql would return 127000 rows
    The sql is
    select
      lde.ods_system,
      lde.ldekey,
      msg.sendersystem, 
      msg.messagetype,
      msg.messageversion,
      msg.msgseqnumber,
      msg.alternatekey,
      msg.crudmarker,
      msg.clrbookdate,
      msg.clrbookresult,
      lower('udf_'||msg.messagetype) button,
      lde.ldekey||'.'||msg.alternatekey||'.'||msg.msgseqnumber udm_key
    from
      clr_esbmessageheader msg,
      clr_adm_systemmessage adm,
      udm_lde lde
    where
      adm.ldeid = lde.ldeid and
      msg.sendersystem = adm.system and
      msg.messagetype = adm.messagetype and
      msg.messageversion = adm.messageversion and
      msg.receiversystem = 'SCIPS'
    order by msg.clrbookdate desc
    This report only takes 1 second to display.
    I need to add a conditional link to another page, so I used
    case
    when lower('udf_'||msg.messagetype) = 'udf_distreceipt' then
    '<a class="type" href="' || apex_util.prepare_url('f?p='||:APP_ID||':52:'||:APP_SESSION||'::'||:DEBUG||':RIR'||':IR_MSG_KEY,P52_PG:'|| lde.ldekey||'.'|| msg.alternatekey ||'.'|| msg.msgseqnumber ||','|| 50, null, 'SESSION') || '"title="Go to udf_distreceipt Report">udf_distreceipt</a>'
    else 'no link' end table_link
    The sql seems to be ok, because the report accepted it, but selecting the new column and saving the report takes forever (over 2 mins)
    Now the report takes over 2 minutes to run and I still need to add more conditions.
    Have I coded the link incorrectly ?
    Gus

    Hi Gus,
    Are you wanting to put the link in the query for a specific reason?
    I had to do a similar thing in the past and just completed the column link section for the column.
    Why not just have the following in the query:
    case
    when lower('udf_'||msg.messagetype) = 'udf_distreceipt' then
    udf_distreceipt
    else null END table_link
    Then do the linking using column link section:
    You would specify your link text as #TABLE_LINK# which should then be conditionally displayed due to the case statement, then add in all the page item and values to pass across using a normal link column.
    Thanks
    Paul

  • Report Problem need to fix the code

    Hello Expert
    I am new to apex, I was given a task to interpret the code and fix the problem.
    This Apex application has a list of value where the user select the institution as a drop down list menu. After selecting the institution the main report below the drop down list will be populated based on the selection. The problem is that when the user insert record for standalone program, this insert don't appear on the report when the user select the instituion.
    can someone look at the code below and explain to me line by line what it does and how can I twick it to solve this problem? I am cloue less and I need expert help
    select dt.* 
             ,case when dt.delivery_location is null then null
                      else htf.anchor ('javascript:void(0);'
                                              ,'<img src=#APP_IMAGES#location.png
                                                title=''' ||dt.delivery_location || '''
                                                alt=''' ||dt.delivery_location || '''
                                                height=24 width=24/>'
              end dl_hover
      from (
    select
            CASE WHEN INDEP_DEGREE = 'Y' THEN
            CASE WHEN Dt.DEGREE_ACRONYM IN ('AACC','ASCC') then
              da.DESCRIPTION   || ' with an Emphasis Area of ' ||
                     NVL(Mt.DESCRIPTION,cC.DESCRIPTION)
                ELSE    
             nvl(dt.description, da.DESCRIPTION)
             END
             ELSE
                CASE WHEN Dt.DEGREE_LEVEL IN ('V','A') THEN
                     nvl(dt.description, da.DESCRIPTION )  || ' with an Option in ' ||
                     NVL(Mt.DESCRIPTION,Cc.DESCRIPTION)
                WHEN Dt.DEGREE_LEVEL IN ('E','C','Z','F')  THEN
                     nvl(dt.description, da.DESCRIPTION )  || ' in ' ||
                     NVL(Mt.DESCRIPTION,Cc.DESCRIPTION)
                ELSE    
                     nvl(dt.description, da.DESCRIPTION )  || ' with a Major in ' ||
                     NVL(Mt.DESCRIPTION,Cc.DESCRIPTION)
                END
        END
    degree_name
    --,'???' emphasis_area
    ,nvl(mt.cip_code,dt.cip_code) cip_code
    ,nvl(mt.hours, dt.hours) total_credit_hours
    -- ,dt.deactivated status
    ,case when nvl(mt.deactivated,dt.deactivated)  = 'A' then 'Active'
              when nvl(mt.deactivated,dt.deactivated) = 'D' then 'Deactivated'
              when nvl(mt.deactivated,dt.deactivated) = 'T' then 'Terminated'
          WHEN NVL(mt.deactivated,dt.deactivated) = 'I'
          THEN 'Inactive'
              else null
       end status
    --,dt.degree_level program_type
    ,dl.description program_type
    ,dt.coop_indicator coop_indicator
    ,nvl(mt.approval_date,dt.approval_date) approval_date
    ,nvl(mt.implemented,dt.implemented) implemented
    ,nvl(mt.implementation_date, dt.implementation_date) implementation_date
    ,nvl(mt.delivery_mode ,dt.delivery_mode) delivery_mode
    ,(select rtrim(replace(replace(xmlagg(xmlelement("C" ,c.cixxvext_name)).getclobval() ,'<C>' ,'') ,'</C>' ,'&#xD; ') ,'&#xD; ') C
      from degree_transaction_details dtd
             ,cixxvext c
      where (dtd.degree_transaction_id = case when INDEP_DEGREE= 'Y' then dt.degree_id else mt.major_id end )
          and c.cixxvext_ext_site_cd = dtd.detail_value
    and dtd.record_type= case when INDEP_DEGREE = 'Y' then 'DEGREE' else 'MAJOR' end ) delivery_location
    ,dt.degree_id degree_id
    ,'Comparison Report' comparison_report
    ,apex_util.prepare_url ('f?p=&APP_ID.:2:&SESSION.::&DEBUG.:2:P2_FICE_CODE,P2_DEGREE_ID:&P1_FICE_CODE.,'||dt.degree_id) edit_link
    ,apex_util.prepare_url ('f?p=&APP_ID.:4:&SESSION.::&DEBUG.:RP,4:P4_DEGREE_ID:'||dt.degree_id) cr_link
    ,dt.description
    ,mt.major_id major_id
    ,nvl(mt.online_percentage,dt.online_percentage) online_percent
    ,nvl(mt.last_inst_review,dt.last_inst_review) last_inst_review
    from degree_transactions dt,
        degree_acronyms da,
        major_transactions mt,
        degree_levels dl,
        cip_codes cc
    where dt.degree_id = mt.degree_id
      and mt.cip_code = cc.cip_code
      and dl.degree_level = nvl(mt.degree_level,dt.degree_level)
      and dt.degree_acronym = da.degree_acronym
      and dt.Fice_code = da.fice_code
      and dt.degree_level = da.degree_level
      and dt.deactivated in ('A','D')
      and mt.deactivated in ('A','D')
      and dt.fice_code = :P1_FICE_CODE
      and dt.show_inst = 'Y'
    ) dt
    order by dt.description nulls first

    You said:
    "I was able to debug the code in SQL Developer."  Does this mean that you:
    ran the code, got results
    then set indep_degree to 'Y' on a row in your database
    ran the code again and saw the results you are looking for?
    If true, your code is working and should operate the same in APEX.
    So if your code is working, we need to understand what processes are running on the form and when they are firing.
    Jeff

  • Interactive Report Download and Session State Protection

    I have created an Interactive Report in an APEX application that I have enabled
    session state protection for. The issue I am having is with the "Download"
    functionality of the interactive report to a .csv file.
    The URL created by selecting Download from the drop down (javascript:gReport.controls.download();)
    is built or constructed without a checksum thus causing the error below.
    Error
    No checksum was provided to show processing for a page that
    requires a checksum when one or more request, clear cache, or argument
    values are passed as parameters.
    The anchor tag containing the URL (/f?p=app_id:page:session_id:CSV:) is contained within
    &lt;div id="apexir_CONTROL_PANEL_DROP" class="drop_panel
    clearfix" style=""&gt;
    Running the following: Application Express 3.1.0.00.32 on Oracle Database 10g Enterprise Edition Release 10.2.0.3.0
    Is there a way to add a checksum to this? OR does anyone have any ideas on how to work around this?
    Edited by: Bryce Tuohy on Feb 26, 2009 10:08 AM

    WORKAROUND:
    1.) Create hidden ITEM on page (I named it P23_PREPARED_CSV_DOWNLOAD_URL).
    Enter the following for the ITEM
    as the SOURCE_TYPE : PL/SQL Function Body
    as the SOURCE: return apex_util.prepare_url('f?p=&APP_ID.:&APP_PAGE_ID.:&APP_SESSION.:CSV:')
    2.) Create BUTTON that executes javascript to open POPUP window with this url.
    a.) Create Button and enter
    &lt;a href="javascript:popupURL('&P23_PREPARED_CSV_DOWNLOAD_URL.')"&gt;Download and Save to CSV file&lt;/a&gt;as the "Text Label/Alt"
    Originally had custom code for javascript POPUP and this is not needed .... just use the APEX javascript function.
    Edited by: Bryce Tuohy on Mar 5, 2009 10:47 AM

  • Interactive report, conditional display of column link

    Hello,
    We have requirement to disable editing in case that status of field is 1 (1=Closed).
    Is there any way to disable it on interactive report.
    case when status=1 column link should be disabled (not visible) in order to prevent future edits on payroll.
    SELECT payroll_no, status
    FROM hr_payroll
    ORDER BY payroll_no DESC;
    I tried link below, but it's not working in my case.
    http://nerd.net.au/24-apex-application-express/report-layout/92-conditionally-show-report-link-column-based-on-value-of-…
    Oracle Database 11g Express Edition Release 11.2.0.2.0 - Production
    Application Express 4.2.2.00.11
    Thank you in advance,
    Regards, FM

    CASE WHEN status = 'ACTIVE' then
    <a href="f?p=&APP_ID.:60:&SESSION.::&DEBUG.::P60_EMPLOYEE_ID:'||employee_id||'"> </span><br /><span class="Moobi_Code"><img src="#WORKSPACE_IMAGES#deactivate_button.png"></a>'</span><br /><span class="Moobi_Code">ELSE NULL END deactivate_employee,
    from
    EMPLOYEES
    What exactly is the error you get? What HTML is showing in the HTML source?
    Just by looking at this I would say you need to remove the "/" in front of the f?p
    Keep in mind this way could cause problems if you start to use checksum, then you might want to look into using APEX_UTIL.PREPARE_URL to create your URL.

  • How can I pass paramters to next page with session protection on?

    Hi, guys:
    I encounter a problem of session protection problem. In a report page I set up a column of "map" link, so I can pass several parameters extracted from the same row to the new page where I can show map. I was using javascript popup2, and it worked well.
    javascript:popUp2('f?p=&APP_ID.:3006:&SESSION.::&DEBUG.::P3006_H_OFFENDER_NAME,P3006_H_OFFENDER_ID,P3006_H_ADDRESS_LATITUDE,P3006_H_ADDRESS_LONGITUDE,P3006_H_PHYSICAL_LATITUDE,P3006_H_PHYSICAL_LONGITUDE,P3006_H_ADDRESS,P3006_H_PHYSICAL_ADDRESS:#Offender Name#,#Offender ID#,#Address Latitude#,#Address Longitude#,#Physical Latitude#,#Physical Longitude#,#Address#,#Physical Address#','650','450');However, I am required to set all of pages, items with session protection now. after that I got problem as:
    Attempt to save item P3006_H_OFFENDER_NAME in session state during show processing, item has Internal Only protection.
    Contact your application administrator.
    So I changed it as redirect a page in application, and try to pass less parameters and query other parameters, but I got the similar problem:
    Attempt to save item P3006_H_OFFENDER_ID in session state during show processing, item has Internal Only protection.
    Contact your application administrator.
    I notice most of solutions would be turning the session protection as unrestricted for these items, but I am not allowed to do this. Is there any way that I can pass parameters from a row in a report while session protection is on?
    Thanks a lot!
    Sam

    I can quickly show you what I've done to solve for this:
    First, create a PL/SQL Anonymous block, application level process of type "On Demand"  Here is an example of what I'm using - I named the process is SIMPLE_SSP (name is important later)
    declare
    l_url varchar2(1000);
    s_url varchar2(2000);
    begin
    l_url := wwv_flow.g_x01; -- the apex name is g_x01 - note the key in the key value we pass later in javascript
    s_url := apex_util.prepare_url(p_url => l_url,p_checksum_type => 'SESSION'); -- and here's where we get checksum
    htp.p(s_url); -- and here's where we return it
    end;
    Next, I create a javascript function that can be called in the link
    function redir_ssp(p1,p2,p3) {
    var param1 = p1;
    var param2 = p2;
    var param3 = p3;
    // notice when creating our Ajax object we reference the Application process by name
    var ajaxReq = new htmldb_Get(null, &APP_ID., 'APPLICATION_PROCESS=SIMPLE_SSP', 0);
    var sURL = 'f?p=&APP_ID.:4:&SESSION.::::P4_PARAM1,P4_PARAM2,P4_PARAM3:'+param1+','+param2+','+param3;
    // notice the 'x01' literal mirrors the built in apex var we used above. x01, x02, x03 ... etc match their counterparts.
    // you can use many parameters as long as you deal with them in the proc the same way
    ajaxReq.addParam('x01',sURL);
    var retURL = ajaxReq.get(); // and the htp.p is passed into the ajax get which is then returned in the retURL
    //alert(retURL); // for debug
    window.location.href = retURL; //this is the redirect.
    Finally in the link
    &lt;a href="#" onclick="Javascript:redir_ssp(p1,p2,p3)"&gt;link text&lt;/a&gt;
    This can be easily altered to use in a pop up.

  • How to remove hyperlink in Reports Region

    How to remove hyperlink in a Report region (Based on some filter condition)
    Example : In Report Region, I am getting value as 10, 20, 30, 0, 44, 55, 0
    In the above value, I need to remove the hyperlink for 0 values.
    Can anyone help me to resolve this issue.
    Thanks in advance.
    Regards
    Balaji S

    If you want a link column for values other than 0 and a blank for those with 0 then the best way to do this is to use a case or a decode to return a LINK image or text to a hidden column; I usually return the Edit icon only. You can then use the 'column link' region on a different column to create a link in the usual way and set the Link Text to the hidden column (e.g. #EDIT# in the example below). If you have set the target page to require a Checksum this will then be added without having to code it into your sql. E.g.
    SELECT some_columns, 
      CASE WHEN numcol != 0 THEN '<img src="#IMAGE_PREFIX#e2.gif" alt="">'
      ELSE null
      END "EDIT"
    FROM your_tableIf you want the same column value, but those of 0 to not have a link and those other than 0 to have a link then you need to code the link into your sql. e.g.
    SELECT some_columns, 
      DECODE (numcol,0,numcol,'<a href="f?p=&APP_ID.:11:&SESSION.::&DEBUG.:11::">'||numcol||'</a>') "EDIT"
    FROM your_table# = your URL e.g f?p=&APP_ID.:11:&SESSION.::&DEBUG.:11::
    If you require a checksum on the link you need to add the apex_util.prepare_url function to the URL.
    Cheers
    Shunt

Maybe you are looking for