Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

150
Views
Execute query before _save event on an Oracle Apex interactive report

I recently found an article about "[How to Intercept Interactive Report Save and Delete Functions in APEX][1]", very helpful! but i need to do some validations before this events and i don't know how to do it, I would like know if you could help me solve it.

The principal goal is to restrict the number of private reports that can save a user, example limit to 1 private report saved per user.

This is the code to intercept this events:

$(document).ready(function() {

  $.widget("apex.interactiveReport", $.apex.interactiveReport, {
    
    // Saving a Default report
    _saveDefault: function () {
      console.log("_saveDefault");
      console.log(this);
      console.log(this._getId("report_name"));
      console.log('stopping');
      // return this._super();
    },

    // Saving a Public or Private reports
    _save: function () {
      console.log('_save');
      console.log(this);
      console.log(this._getId("report_name"));
      console.log('stopping');
      // return this._super();
    },

    // Deleting a report (user clicking the "X")
    _remove: function () {
      console.log('_remove');
      console.log(this);
      console.log(this._getId("report_name"));
      console.log('stopping');
      // return this._super();
    }
  });

});```


  [1]: https://www.talkapex.com/2019/02/how-to-intercept-interactive-report-save-and-delete-functions-in-apex/
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Note that the blog post you are referencing is using undocumented features. There is no guarantee that that functionality will not change in future versions and they are not supported. You could do this in a different (supported way) way, using the data dictionary views and the APEX_IR API. It's not as clean as doing it javascript (which by the way, I don't know how to implement).

Here is what I did (my app is 28183 and page is 7). The logic is that after refresh of the IR (if you save a private report, the region is refreshed), check in pl/sql if the max amounts of private reports is exceeded. If it is, delete the last one and inform the user with an alert.

  • Create a page item P7_MAX_REACHED
  • Create a dynamic action After Refresh of the interactive report region.
  • Create a true action of Execute Server-Side Code with source:
BEGIN
  select COUNT(report_id) INTO :P7_MAX_REACHED from  APEX_APPLICATION_PAGE_IR_RPT where application_id = 28183 AND page_id = 7 AND report_type ='PRIVATE';
EXCEPTION WHEN OTHERS THEN
  :P7_MAX_REACHED := 0;
END;
  • Now create a 2nd dynamic action on change of P7_MAX_REACHED with client side condition of Item > Value (Item P7_MAX_REACHED, Value 1)
  • Create a true action of type Alert with text "Can only save 1 Private Report"
  • Create a true action of type Execute Server-Side Code with source
BEGIN
  FOR r IN 
  (SELECT report_id, ROW_NUMBER() OVER (ORDER BY created_on ASC) AS rn
     FROM  APEX_APPLICATION_PAGE_IR_RPT where application_id = 28183 AND page_id = 7 AND report_type ='PRIVATE'
  )
  LOOP
    IF r.rn > 1 THEN
      APEX_IR.DELETE_REPORT(p_report_id => r.report_id);  
    END IF;
  END LOOP;
END;
  • Add another true action of type Refresh interactive report region
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!