This discussion is archived
13 Replies Latest reply: Jul 30, 2013 1:25 PM by jrimblas RSS

APEX application process execution

Kotodid Newbie
Currently Being Moderated

Hi!

Application process (with htp.p in it) does not execute when onSubmit page process returns error (and shows it in notification bar).

How can I make process to execute? Or it is a bug?

 

You can see example in test application Report 1

Just press SUBMIT button and see difference near phrase "application process is here" at the top.

 

Thank you!

  • 1. Re: APEX application process execution
    jrimblas Expert
    Currently Being Moderated

    It's not a bug at all.

    You have two stages in an APEX page, rendering and processing.  The On Submit stuff happens at the time of processing. Think of this as code that runs on the DB and as such it cannot render the page.

    So your htp.p commands need to happen on the Rendering phase of the page so that you can see their output.

     

    You'll need to re-think your solution and do something in the processing that will "tell" the rendering to run some PL/SQL that contains HTP.P commands.  This is usually easily done. You could set an item value like P3_DYNAMIC = 'YES' then on Rendering have your region or process that only runs when P3_DYNAMIC = 'YES'

     

    Hope this helps.

     

    Thanks

    -Jorge

  • 2. Re: APEX application process execution
    Kotodid Newbie
    Currently Being Moderated

    Thanks for your answer, Jorge.

     

    I understand, that there are rendering and processing stages, but I see the page after processing (submission), so - it was rendered. And I want the process to be executed.

     

    I don't think your solution help me. My unconditional process does not run. And it would not run if I set condition for dynamics.

     

    And I cannot run "AFTER SUBMIT" process, because my current process returns error and stops other processes.

  • 3. Re: APEX application process execution
    LT.ora Explorer
    Currently Being Moderated

    Hi Kotodid,

     

    could you tell me what is the actual requirement(giving message/notification after record is inserted ?);

    may be we have some other ways to do the same.

  • 4. Re: APEX application process execution
    Kotodid Newbie
    Currently Being Moderated

    Hi LT.ora,

    I render saved user styles from db table in this application process. Styles are needed on every page of application depending on page number (or application unit) and APP_USER.

  • 5. Re: APEX application process execution
    LT.ora Explorer
    Currently Being Moderated

    I hope you've gone through Understanding Substitution Strings

  • 6. Re: APEX application process execution
    Kotodid Newbie
    Currently Being Moderated

    Hm, certainly I know about Substitution Strings, but how can it solve my problem? I have no problem with selecting needed data.

    My problem in showing this data into page processing stage.

  • 7. Re: APEX application process execution
    LT.ora Explorer
    Currently Being Moderated

    Could you send me the process you need to run

  • 8. Re: APEX application process execution
    Kotodid Newbie
    Currently Being Moderated

    Something about:

     

    begin

      htp.p('<style id="userStyles" type="text/css">');

      for cur in (select t.param, t.value

                       from USERDATA t

                     where t.authid = :APP_USER

                        and t.application = :APP_ID

                        and t.page = :APP_PAGE_ID) loop

            htp.p('#' || cur.param || ' {' || cur.value ||'}');

    end loop;

    htp.p('</style>');

    end;

  • 9. Re: APEX application process execution
    LT.ora Explorer
    Currently Being Moderated

    why not create multiple CSS files for different users and change css file while authentication

  • 10. Re: APEX application process execution
    Kotodid Newbie
    Currently Being Moderated

    Do you think it is real?!

    There are hundreds of users and they can dynamically change their styles.

  • 11. Re: APEX application process execution
    fac586 Guru
    Currently Being Moderated

    You can do this using a substitution string as mentioned above. Instead of outputting the results of the user style query using htp.p, create a USER_STYLES application item and store them in it:

     

    declare
      l_user_styles varchar2(4000);
    begin
      for cur in (select t.param, t.value
                      from USERDATA t
                    where t.authid = :APP_USER
                        and t.application = :APP_ID
                        and t.page = :APP_PAGE_ID) loop
            l_user_styles := l_user_styles || '#' || cur.param || ' {' || cur.value ||'}');
      end loop;
      :user_styles := '<style id="userStyles" type="text/css">' || l_user_styles || '</style>';
    end;
    

     

    The application item can then be referenced in page template headers using substitution string syntax: &USER_STYLES.

     

    This approach is more efficient than what you are trying to do as the user style information only needs to be set in the application item on login and when the styles are changed, rather than on every page show as you are proposing.

  • 12. Re: APEX application process execution
    Kotodid Newbie
    Currently Being Moderated

    This is very helpful solution, thank you!

    The only disadvantage is that I have to put &USER_STYLES. substitution in every page template in my application, but it is possible.

  • 13. Re: APEX application process execution
    jrimblas Expert
    Currently Being Moderated

    Kotodid wrote:

     

    I understand, that there are rendering and processing stages, but I see the page after processing (submission), so - it was rendered. And I want the process to be executed.

     

    I know this is now answered and the solution is fine.

    I just need to explain something because of the comment you made "I see the page after processing (submission), so - it was rendered".  It will make your work with APEX better.

    When you see the page right after processing, that is the Rendering again and NOT the processing. Processing does NOT render anything.

     

    Thanks

    -Jorge

     

    PD. Sorry, I didn't get CC on your previous replies.

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points