Read XLXS Files from APEX 5.0 and Higher – One (or Two) Ways

In my work as a consultant I often have the task of getting data from MS Excel spreadsheets into tables in the database.

If this is a one-time load, the process is simple – use either SQL Developer or, easier yet, use the Data Load Workshop in APEX:  SQL Workshop –> Utilities –> Data Workshop.

If the requirement is for a repeated load or many files, I need to set up some automated process for reading in the data.  I do not want to ask my users to open the XLSX files, save the data to CSV, then upload the CSV files.  That makes for unhappy users, at best.

I am sure there are several options for load XSLX files into Oracle data tables.  I am going to focus on a two I have used (and continue to use) successfully across several clients, across many projects.  And another option that used to be a very good option, that goes away with APEX 5.0 and higher.

Let’s do Bad News First.

The Option That Goes Away:

With APEX Listener, now Oracle REST Data Services, ORDS, we gained a wonderful utility for loading XLS or XLSX files into the database.

I will not elaborate on that here, for reasons which will be obvious in a bit.  I did cover that option, and several other Data Load options, in this presentation, How Do I Load Data, Let Me Count the Ways..  Most of these options still apply.  Yes, it is a PowerPoint, but gives you enough detail to get going.

This ORDS-based utility works fabulous for APEX versions less than APEX 5.0.  It loaded data into a collection. You can process your data however you wish from there.  However, as of APEX 5.0, APEX uses JSON to move data, and the ORDS Excel file upload function no longer works.  Joel Kallman explains this clearly in his blog, Let’s Wreck This Together, here.  It will still work for APEX versions < 5.0 – that is, APEX 4.2, APEX 4.1.  But beware, if you are using this Excel-Upload option of ORDS in APEX 4.1 or APEX 4.2 applications, you will need to make some changes when you upgrade those applications to APEX 5.0 and above.

The XLSX Option That Still Works – READ_XLSX

Thanks to Anton Scheffer from AMIS, we have a PL/SQL package that reads .XSLX files from a file in a file server folder that has been mapped to an Oracle directory.  That sounds like a mouthful, but it is simple.

You have files in a folder.  You or your system administrators arrange for that file system folder to be available to the database – usually a mapping of the physical folder to a virtual folder on the database file server.  Then your DBA creates an Oracle directory that points to the folder, physical or virtual, on the database file system. And grants appropriate grants so you can see and read and/or write from /to that Oracle directory.

Now Anton’s package, READ_XLSX comes in.  download the package, read Anton’s blog post.  I am only going to summarize here.

READ_XLSX consists of two main functions, one to read the contents of an XLSX file into a BLOB (named file2blob), and another to read the contents of that BLOB into records (this one is named “read“).  Cast the results of the read function as a TABLE, and voila, you have the results of your XLSX file.

This statement is the guts of it:

SELECT * FROM TABLE( as_read_xlsx.read( as_read_xlsx.file2blob('MY_ORA_DIRECTORY',
 'MyExcelWorkbook.xlsx' ) ) );

Now if you are like me, you do not want ot have to keep typing that SELECT statement.  So I turn it into a view:

CREATE VIEW MY_SPREADSHEET_V AS SELECT * FROM TABLE( as_read_xlsx.read( as_read_xlsx.file2blob('MY_ORA_DIRECTORY',
 'MyExcelWorkbook.xlsx' ) ) );

Now I can query from the view the same as I query from any other table or view I have access.  And incorporate queries from that view into any packages, procedures and functions that I build to meet the requirements of the task at hand.

When I have a series of files in a folder, I use a version of GET_DIR_LIST to read files from the Oracle directory.  (GET_DIR_LIST is a java utility, wrapped in PL/SQL, that returns the list of file names in a folder in a one-column table). You probably have your own method of doing the same.  Then, in a loop, I use dynamic SQL to point my view to the next file in the loop, call my loading procedure to process the contents of that file, then move on to the next file.  OF course I have all kinds of validations and error checking in there, as much is needed depending on the task at hand.  Once configured, the process is clean, reusable, easily customizable and – best of all – works in APEX 5.0 and above.

I did not use Anton’s READ_XLSX directly.  Why?  At the time I downloaded it (years ago now), Anton’s package handled cells of up to 4000 characters.  The spreadsheets I had to load contains some cells with > 4000 characters.  So I made a slight adjustment to handle CLOBs.  I described those customizations here.  I suspect most persons will not need such a customization.

Another (Better?) Option – EXCEL2COLLECTION Plugin:

Is READ_XLSX the only way? No. Seems like too much work? Yup, it can be.  Anton apparently thought so too, because he came up with EXCEL2COLECTION, a utility APEX Plugin that, with less coding than the READ_XLSX package, will read data from an XLSX, XSL, XML 2003 or CSV file into a PL/SQL collection.  I have also used this plugin successfully across several customers and projects.

I have used the EXCEL2COLLECTION plugin in conjunction with a customized instance of the APEX Data Load Wizard to enable simpler (from a user perspective) upload of XLSX files.  I describe more of that process here.  The APEX Data Load Wizard does not out-of-the-box allow upload of XLSX files – one needs to cut/paste.  Integrating the EXCEL2COLLECTION plugin into a customized Data Load Wizard series of pages makes use of other features of the Data Load Wizard – like the column mapping page – possible.  Beware, that customizing the Data Load Wizard pages and process flow means that your work is subject to break upon any and every APEX upgrade.  This customization of the Data Load Wizard process is unsupported territory.  Note that the EXCEL2COLLECTION plugin itself is supported (by Anton). My use of it in customizing the Data Load Wizard is not.

Bottom line:

Anton’s READ_XLSX remains one of the best methods of reading XLSX data into an Oracle database, when the requirement is to read many XLSX files.  When using APEX, investigate using the EXCEL2COLLECTION plugin; that will make your XLSX load tasks easier.  For one-of data loads, I still use SQL Developer or the APEX SQL Workshop Data Workshop utility.  Need to script the load for Production?  Use SQL Developer in a DEV environment, then use SQL Developer to generate a load script, there are several options for that.

Happy Data Loading!

 

 

 

Last Day! ODTUG Innovation Award

June 2nd is the LAST DAY for ODTUG Innovation Award nominations.

Make your nomination for the latest, greatest piece of awe-inspiring work using Oracle development technologies today.

It’s simple, go to the ODTUG Innovation Award Nomination page. Tell us about your nominee – or nominate yourself!  Everyone is eligible – make your entry today.

Is is a Cloud hybrid?  An APEX plugin? An open-source project that leverages Oracle tools?  A real clever in-house application of  Oracle JET? A really neat product from Oracle?  Anything goes!

Today is the last chance  to make your 2017 nomination.

The ODTUG Innovation Award honors excellence in creative, effective, and innovative use of Oracle development tools within ODTUG’s supported communities (ADF, APEX, BI, Database, EPM and Career). The goal is to honor developers – individuals or teams – whose passion and creativity shine through in their application of Oracle technology to address real-world problems.  Note that this year we are not excluding anything or anyone, so projects and individuals from all organizations (Oracle, too!) are welcome.

Remember that ODTUG members get to vote this year.  Make your nomination, then vote for it too! Member voting will be combined with judges scoring to determine an overall Innovation Award winner.

Check out the full information on the ODTUG web site here:

ODTUG Innovation Award Nominations

Best wishes to all our nominees!

 

ODTUG Innovation Award ~ Make Your Nomination Now!

Nominations for the 2017 ODTUG Innovation Award are open now through June 2nd.  Make your nomination now, before your Memorial Day weekend.

We are looking for innovative, exceptional, ahead-of-the-curve applications of Oracle development tools that stand out as examples of “the next big thing”, or maybe the really neat next small thing,  in Oracle technology.   Can’t think of anything? Nah, I don’t believe that.  Consider:

  • Do  you have, or does your co-worker have an unusually creative application or combination of new and emerging Oracle tools?
  • Did you find a new open source project that makes your life easier?  Open source projects are eligible, as long as they integrate some Oracle technology.
  • Does your latest project enable faster, smoother, cleaner adoption of an Oracle tool?
  • Are you envying someone else’s work, saying “Wish I thought of that …”?
  • Have you seen a real neat learning tool that aids others in understanding a new Oracle tool?   All projects, large and small, are eligible.
  • Does your organization have an exception program for attracting or training persons new to Oracle technology?
  • Have you created, seen or adopted a new plugin or feature, large or small, that others may not have seen yet?

We are looking for the stuff that makes you say “Wow, great idea …”  or “Neat stuff …” or “wicked cool …” (you can tell where I am from).  We need your help to get as many innovation examples in before the June 2nd deadline.

Now is the time to make your nomination.

The ODTUG Innovation Award honors excellence in creative, effective, and innovative use of Oracle development tools within ODTUG’s supported communities (ADF, APEX, BI, Database, EPM and Career). The goal is to honor developers – individuals or teams – whose passion and creativity shine through in their application of Oracle technology to address real-world problems.  Note that this year we are not excluding anything or anyone, so projects and individuals from all organizations (Oracle, too!) are welcome.

Note that ODTUG members get to vote this year.  Make your nomination, then vote for it too! Member voting will be combined with judges scoring to determine an overall Innovation Award winner.

Check out the full information on the ODTUG web site here:

ODTUG Innovation Award Nominations

Nominations close June 2nd, so act soon!

ODTUG Innovation Award 2017 ~ Nominations are Open!

Nominations for the 2nd Annual ODTUG Innovation Award are now open!

The ODTUG Innovation Award honors excellence in creative, effective, and innovative use of Oracle development tools within ODTUG’s supported communities (ADF, APEX, BI, Database, EPM and Career). The goal is to honor developers – individuals or teams – whose passion and creativity shine through in their application of Oracle technology to address real-world problems.

We are looking for innovative, exceptional, ahead-of-the-curve applications of Oracle development tools that stand out as examples of “the next big thing” in Oracle technology or as unusually creative applications of new and emerging Oracle tools.  The stuff that makes you say “Wow, great idea …”  or “Neat stuff …” or whatever rad saying you use.

Now is the time to make your nomination.

What is it this year: A new Cloud implementation?  A clever APEX integration? A cross-platform collaboration?  The sky (cloud joke) is not the limit!

New this year is Member Voting – all ODTUG members are invited to vote for your favorite Innovation Award nomination. Yes,  we want YOU to help decide the 2017 Innovation Award winner. Member voting will be combined with judges scoring to determine an overall Innovation Award winner.

Check out the full information on the ODTUG web site here: ODTUG Innovation Award Nominations

Nominations close June 2nd, so act soon!

ODTUG

The 2017 ODTUG Innovation Award nominations will be reviewed by a team of judges according to these general topics:

  • Innovation – The “wow” factor: acknowledges the exceptional and innovative
  • Quality – Not only does it have to be “wow,” but it has to work
  • Applicability – Evaluates subject matter importance, completeness, effectiveness, and accuracy
  • Topic merit – Treatment of a cutting-edge topic, technical complexity, or new and unique approach to a common problem

Judges score will be combined with member voting results to determine the overall winner.

For guidance, a perfect example of innovation with Oracle tools is our 2016 Innovation Award Winner: Mia Urman, AuraPlayer 

AuraPlayer and Oracle joined forces to mobilize the Oracle Forms based collision reporting system for the New York MTA to a new Oracle Mobile Cloud based application without redevelopment. In the past, MTA’s officers had to manually fill out accident reports in the field and then deliver it to a data entry clerk who would then enter the information into MTA’s legacy system.  Using AuraPlayer and Oracle’s Mobile cloud they were able to create a “mobile-ready” version of the application without the need for redevelopment or migration of the underlying Oracle Forms system. To enable this modernization, REST services were automatically generated from the Oracle Forms business processes using AuraPlayer. The REST services communicate with the Oracle Mobile Cloud Service, enabling authentication and push notifications, as well as application monitoring and analytics.

Using this application, MTA employees are now able to gather collision information and in addition, now capture photos of the accidents and documents on their tablets.  This data is automatically updated by AuraPlayer into MTA’s Oracle Forms system.  The mobile app also works offline, even without cell or Wi-Fi coverage, this is especially important when an officer is working in a tunnel or on the middle of a bridge. With the real-time submission of traffic accident reports, MTA can assess damages much quicker, determine if a crew is needed to repair damage, and clear the scene in much shorter time—in some cases minutes, instead of hours. The need to manually type collision reports after the fact was eliminated, and the efficiency, accuracy, and timeliness of the data were improved.

See more about AuraPlayer here.

Congratulations, Mia and AuraPlayer!

 

APEX 5 IR Guts and Performance

APEX 5 Interactive Reports (IR) are powerful out of the box, but one can significantly improve performance by strategic settings of certain key parameters.  The full presentation covers all the options.

When your data volumes are low to medium, there may not be much noticeable difference. But when data volumes are high, or the query is resource intensive, the following advice and settings can have a significant performance impact.

In brief:

  • Tune your query, then fine-tune your SQL query. Any slowness here will be magnified in APEX
  • Check MAXROWCOUNT.   The more rows, the longer it takes APEX to retrieve them.  do users really need ALL the rows? OR is it reasonable to ask users to filter first. (APEX 5.1 Interactive Grid will include features to FORCE users to filter first – nice!) Consider  supplying users who need to Download All a separate pag,e os not all users are handicapped by a high MAXROWCOUNT value.
  • Check Max Rows Per Page
  • Check your Pagination setting.  The X to Y of Z is popular, but the “of Z” part is expensive – APEX needs to retrieve all rows then set up pagination. That All Rows part takes time.  Consider using X to Y, and adding a page item that calculates the Z separately. (THere are various options to do this, a topic for another blog post, ranging from a straight COUNT(*) to a sophistcated use of APEX_IR to get the count of the as-filtered IR query)

These are your big-impact settings.

For more info, see the full presentation via the link below or Slideshare:

As you move to APEX 5 Interactive Grid, these three settings till apply – but you have better pagination options, and pagination works differently – heck, all of Interactive Grid works differently – better!  So watch here for upcoming information on Interactive Grid.

APEX5 IR Guts and Performance

Smart use of the IR settings makes for a better end user experience ~ and that’s the whole point!

Vote for the ODTUG Board

Vote for the ODTUG BoardI seek your vote for the ODTUG Board of Directors so I may actively establish and maintain ODTUG as the center of excellence for Oracle developers. After years of work behinds the scenes, I wish to take a more active role in steering ODTUG forward.

Through 30+ years of development experience,working with persons at all levels –  CEO/CIO/CTO, analysts, architects, developer, end users ,trainers – and performing these tasks myself, I have gained:

  • Insight on developer needs and challenges gained via hands-on experience across large and small companies, government and private, large to single-person development teams.
  • Insight on user group operations gained through 11 yrs volunteering at local, regional and national user groups as reviewer, monitor, conference committee member, presenter, attendee and editor. As a board member I will have greater ability to solicit more content in more diverse formats.
  • Eye for timely, quality material on the latest Oracle tools, gained through 8 yrs as Editor, for IOUG and ODTUG
  • Quiet steadfast persistence to get tasks done, even the less glorious ones.

How we developers work and learn has evolved – open source, mobile, cloud, node, JET are now mandatory knowledge.  ODTUG is how and where we thrive – where many of us first learn about new technologies or new applications of them. ODTUG needs to lead members into evolving technologies and best practices by delivering more accessible learning, sharing and networking opportunities.

To achieve improved access and quality of learning opportunities we need to improve accessibility and improve participation:  Let’s create more local events for members to attend, contribute and promote ODTUG, year round, not just at KScope. We need to:

  • Reach more members in more countries through meetups and partnerships with local Oracle and related-technology groups
  • Deliver new-era technical materials by actively soliciting and delivering content from our members via social media, webinars, video, and regional conferences
  • Expand our ODTUG Communities to focus on trends in emerging tools and best practices

We do some of these now – but let’s increase participation – we need to get the word out to non-members to get them to join, and invite all to volunteer in any capacity, large or small.

I was honored as ODTUG Volunteer of the Year in 2012, and have served ODTUG in many capacities in the past 10 years:

  • Editor of the Technical Journal – 8 yrs
  • Leadership Program presenter
  • Established the Innovation Award in 2016
  • Member of 9 Editor’s Choice Award teams
  • Conference material reviewer

I am an Oracle ACE Associate, was a 2016  Oracle Developer’s Choice Award finalist.

I originally joined ODTUG to learn. I originally volunteered to give back. I ask for your vote for the ODTUG Board of Directors to ensure that the ODTUG flow of knowledge continues.

communites

One more time: Do we still need Data Modeling?

Yes, we need still need to do data modeling, and yes, data modeling is a skill that developers need to learn and practice.

Kent’s points are important:
— To get business value out of the data, you need to understand the data
— Even if you don’t need a model to store the data, you DO need a model to understand the data and use it properly
— Know your data!

I see fewer and fewer data modeling session at conferences these days – dull and boring perhaps, but essential for efficient development and data retrieval based on your data.  I see data modeling as a fundamental skill for all IT professionals – at least those working with databases.

ODTUG Technical Journal ~ Into the Sunset

It is with mixed emotions that I formally announce the retirement of the ODTUG Technical Journal … and along with it the ODTUG Editor’s Choice Award, since, well, there will be no Editor.

Retire_Img2

ODTUG Technical Journal, now Retired

Times have changed, significantly, since I first volunteered for the Technical Journal in 2006 – writing book reviews, then as Associate Technical Editor, and finally as Editor.  This is a span of almost 10 yrs.  To put things in perspective, 10 years ago:

  • The top 5 cell phones were NOT smartphones (remember Nokia and Motorola flip phones?)
  • Smartphone options included Blackberry and Palm Treo
  • Twitter was brand new
  • Blogging was just gaining in popularity
  • LinkedIn existed but had not taken off yet (launched in 2003)
  • YouTube was launched, starting video blogging
  • The Kindle did not exist (introduced in 2007)
  • The iPhone did not exist (debuted in 2007)
  • The iPad did not exist (introduced in 2010)
  • The ODTUG listservs were a popular, excellent way of exchanging questions, answers and advice. An actual ODTUG listserv question from September 2005:
Hi,
We are considering using Oracle's HTML DB to do some web development. Does
anyone who has experience in using this, have time to spare to make some 
comments about it?  I am particularly interested if anyone knows from where 
inside of Oracle this came from and if it is likely to have a long shelf life.
Thanks

(see http://www.freelists.org/post/oracle-l/HTML-DB-here-to-stay for a trip down memory lane).

Well, we know what happened with all of the above.  Technology has changed – advanced. Rapidly.

Accordingly, how we Oracle Developers work has changed. How we communicate has changed. How we learn has changed. How we find and consume learning and reference materials has changed from hard-copy, book-based to online, blog and video-based.

The ODTUG Technical Journal served its purpose through the years, providing Oracle developer tools white papers, book reviews, volunteer features, conference highlights and more. The Technical Journal transitioned from quarterly paper editions to 100% online bi-weekly releases at the end of 2012.  The online Technical Journal Corner enabled publication of material of all media types – blog, video, audio as well as traditional white paper format.

Quite simply, it is no longer practical to consistently consolidate the best-of-the-best materials on a single journal or website in a manner that is searchable and accessible to all Oracle developers.  Static web pages have been superseded by blog aggregators and twitter streams. We at ODTUG prefer to stay ahead of the curve in serving our members, and thus our final Technical Journal Corner article will be posted this month, and as of May 1st the ODTUG Technical Journal Corner will be retired. All postings there will stay ~ just no new material added.

The last post will be by Nikos Karagiannidis, SQL Tuning for Day-to-Day Data Warehouse Support, posting in the coming week.

I wish to thank and applaud all those who have contributed to the ODTUG Technical Journal through the years.  I have enjoyed working with each and every one of you ~ far too many individual authors to list here ~ but I thank you all for your contributions.

In particular I would like to thank our long-term dedicated columnists who served for multiple years since I have been editor:  Joe Begenwald, who even delivered his Ask the Experts column when he could not see, Neelesh Shah who contributed years worth of book reviews, Lucas Jellema who taught us all much about Oracle Fusion Middleware, Mark Rittman, star of BI Perspectives, Kevin McGinley for stepping on the BI column, Steven Feuerstein for his unique Confessions of a Quick and Dirty Programmer, Ed Roske and Tim Tow for the Look Smarter Than You Are with Hyperion column, and John King for a wealth of Volunteer Spotlights and overall general encouragement.  Many thanks to Donna Richey-Winkelman and Maggie Tompkins, Editors Emeritus, for setting the bar high as previous editors of the ODTUG Technical Journal.  Finally, I would like to thank Peter Koletzke for teaching me by example how to be a better editor. It has been a privilege working with you all.

So what’s next?  Watch the ODTUG Communities: APEX, Business Intelligence, ADF, Database, EPM, and Career Track where you will find blog aggregators, twitter handles, a Calendar of Events more. Sign up for ODTUG Webinars, free learning from ODTUG experts. Better yet, volunteer! ODTUG is a volunteer organization serving Oracle developers around the world. We need you!

At this time we will also be retiring the ODTUG Editor’s Choice award, traditionally awarded at our annual Kscope conference for excellence in communication of a technical topic.

We at ODTUG still wish to honor excellence in the Oracle Tools development world. Accordingly, I am pleased to announce the inaugural ODTUG Oracle Developer Innovation and Excellence Award, designed to honor innovation, excellence and amazing accomplishment in the realm of Oracle Development Tools adoption and integration.  Watch for more information on this new award – complete details will be released in the coming weeks.

As always, happy coding,

and keep your eye out for Awesome Extraordinary, Innovtive Stuff ~ More Soon!

Karen

Editor Emeritus, ODTUG Technical Journal

Relax.

Off to the Islands, where all retired Editors go

Announcing the ODTUG Innovation Award

What Oracle development project in the past year made you say WOW!

What project, collaborative or individual, demonstrates exceptionally innovative and creative use of Oracle technology?

What stands out as an above-and-beyond example of Oracle technology applied to real world problems? 

To honor such creativity and innovation, ODTUG announces a more modern mode of honoring excellence within ODTUG’s supported communities (ADF, APEX, BI, Database, and EPM), the ODTUG Innovation Award.

The ODTUG Innovation Award honors excellence in creative, effective, innovative use of Oracle development tools. The goal is to honor developers – individuals or teams – whose passion and creativity shines through in their application of Oracle technology to address real world problems in our ODTUG communities.

communites

We are looking for innovative, exceptional ahead-of-the-curve applications of Oracle development tools that stand out as examples of “the next big thing” in Oracle technology, or as unusually creative applications of new and emerging Oracle tools in our ODTUG communities.

To make a nomination for the award, you must be an ODTUG member (Associate or Full). If you are not a member, join ODTUG now.

Who/What is Eligible:

  • Nominees may be individuals or teams that are non-Oracle employees.
  • Nominees need not be ODTUG members, but they must work with a tool that supports at least one of our communities (ADF, APEX, BI, Database, and EPM).
  • Open Source and / or collaborate efforts are eligible.

Nominations:

  • Nominations Open: Now!
  • Nominations Close: May 31st

More information:

What we are looking for are the things that make us go Wow! when we first see them.  Here are a few historical examples:

  • Integration of Oracle Forms and Java ADF (years ago)
  • HTMLDB, when it first came out – and the first practical applications of HTMLDB (years ago)
  • Oracle-based applications on an iPhone
  • Oracle applications of Google Glasses
  • Our first look at Node.js integrated with (extending) an APEX application. (a few years back)
  • Peter Koletzke and Paul Dorsey’s work deciphering and promoting JDeveloper when it first launched

We know sure there are examples from every Oracle technology community. ~ let us know about them!

Judging:

The 2016 ODTUG Innovation Award winner will be decided by a team of ODTUG experts who will review all of the nominations and discuss and rate them according to these general topics:

Innovation – The Wow factor: Acknowledges the exceptional and innovative
Quality – Not only does it have to be Wow, it has to work.
Applicability – Evaluates subject matter importance, completeness, effectiveness, and accuracy
Topic Merit – Treatment of a cutting-edge topic, technical complexity, or a new and unique approach to a common problem.

For this first year, the  ODTUG Innovation Award will be awarded decided by a select panel of experts from across all ODTUG communities. In future years, nominations will be open all year long, and all ODTUG members will be able to vote for their favorite.

Watch for more information on the  ODTUG Innovation Award on all the usual channels: ODTUG emails, Twitter, the ODTUG website,

Our ODTUG Innovation Award honors innovation, excellence and amazing accomplishment in the realm of Oracle Development Tools adoption and integration.   The possibilities are endless ~ What makes you, as a developer, say Wow! ~ Nominate your favorite examples now!

 

APEX 5 Reset IR w Multiple IR on Page

With APEX 5 Interactive Reports (IRs) we have the luxury of having multiple IRs on the same APEX page.

That is wonderful, until it comes time to Reset a particular IR. The usual RIR and CIR syntax operates on ALL IRs on the page. Probably not what you want.

To refresh a single IR, use the standard APEX_IR API REFRESH_REPORT procedure.

Briefly:

  • Add a Static ID to your IR. As best practice, do this for all your IRs.  The Static Id attribute is under the Advanced attribute section.
  • Create a button to trigger the IR refresh. Set the Action to Defined by Dynamic Action.
  • Create a dynamic action, on Click of your new  button.
  • Add two True events, one Execute PL/SQL for the APEX_IR.REFRESH_REPORT call, one Refresh to refresh the IR region.
  • The PL/SQL calls APEX_IR.RESET_REPORT:
DECLARE
    v_region_id apex_application_page_regions.region_id%type;
BEGIN
 -- get the IR region id
 SELECT region_id 
   INTO v_region_id
   FROM apex_application_page_regions
  WHERE application_id = :APP_ID
    AND  page_id = :APP_PAGE_ID
    AND  static_id = 'my-region-id'; -- use the Static Id set in the IR Advanced attribute section
    
 APEX_IR.RESET_REPORT(
   p_page_id => :APP_PAGE_ID,
   p_region_id => v_region_id,
   p_report_id => NULL );   -- resets the last-used report
END; 

If you need to reset a particular, saved report, you will need to query for that report_id and enter it instead of NULL in the APEX_IR.RESET_REPORT call.

The Refresh True action is a simple Refresh on your IR Region.

Be sure to uncheck the Fire on Page Load option for both True actions.

That’s it!