Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

145
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda