4 Replies Latest reply: Nov 25, 2012 9:49 AM by a.stoyanov RSS

    loop apex_application.g_notification

    a.stoyanov
      Hi all,
      I use Oracle APEX 4.0.2. I have a process in before header which has the following code :
      declare
      
      
      begin
      
      for i in (select * from as_repair_history_v) loop
      
      
        if sysdate >= add_months(i.creation_date, 12) and i.description like '%масло%' then
          apex_application.g_notification := ('Клиент : ' || i.name || ' за МПС: ' || i.car_name || ' има нужда от смяна на маслото!');
          
        
        end if;
      
      end loop;
      
      end;
      The issue is that this notification is displayed once/i have more than one rows which satisfy the IF condition/. Is it possible to receive all the rows as notification but not only one of them ?

      Thanks in advance,
      Alexander.
        • 1. Re: loop apex_application.g_notification
          evrm
          Hi Alexander,

          in your code you only save one row at a time.
          You have to concatenate the previous notification with the current row like this:
          apex_application.g_notification := apex_application.g_notification || ('Клиент : ' || i.name || ' за МПС: ' || i.car_name || ' има нужда от смяна на маслото!');
          regards,
          Erik-jan
          • 2. Re: loop apex_application.g_notification
            a.stoyanov
            Hi,
            Thanks for reply - your solution works fine. But is there a way to concatenate the new line?
            I tried like this :
            apex_application.g_notification := apex_application.g_notification || chr(10) ||
                ('<span style="font-weight:bold; color:red">' ||  'Клиент : ' || i.name || ' за МПС: ' || i.car_name || ' има нужда от смяна на маслото!') || chr(10)
            but the result is:
            Клиент : Разсадника за МПС: Пежо 206 има нужда от смяна на маслото! Клиент : Любомир за МПС: роувър има нужда от смяна на маслото! 
            Any ideas?

            Thanks,
            Alexander.
            • 3. Re: loop apex_application.g_notification
              evrm
              Hi Alexander,

              you could try this code:
              apex_application.g_notification := apex_application.g_notification || '<li>'
               || ('<span style="font-weight:bold; color:red">' ||  'Клиент : ' || i.name || ' за МПС: ' || i.car_name || ' има нужда от смяна на маслото!')
               || '</span></li>';
              regards,
              Erik-jan
              • 4. Re: loop apex_application.g_notification
                a.stoyanov
                Many thanks!



                Best Regards,
                Alexander.