Skip to Main Content

APEX

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

IG download - Dynamic filename

partlycloudyOct 31 2018 — edited Nov 2 2018

APEX 18.2

Actions > Download allows us to download report data in, say, CSV format. The filename can be made dynamic using &P1_ITEM. substitution and setting the value using a on-load computation.

But this is set when the page is first rendered. How can I get a dynamic filename for every download with, for instance, to_char(sysdate,'SSSSS') in the filename so this sequence component is a) guaranteed to be unique b) monotonically increasing c) resets every day?

https://docs.oracle.com/database/apex-18.2/AEXJS/interactiveGrid.html#events-section

Is there a beforedownload event or something like that so we can set a page item value in session state before the download starts?

The initActions option looks promising but when I added the example showed in the documentation to the IG Attributes > Advanced > Javascript initialization code, the a) Help dialog is indeed suppressed and b) the shortcut is added to the filter dialog but the new action is not added to the Actions menu. Strange.

If I define a global variable g and grab a reference to it in the initialization code, when I do g.lookup("my-action").action(), the function (alert in this case), is executed but the UI doesn't show the new menu action. I even tried adding actions.update("my-action") after adding the action but that didn't help either.

@"John Snyders-Oracle" What am I missing?

function( options ) {

    options.initActions = function( actions ) {

        // Hide all elements associated with the show help dialog action

        actions.hide( "show-help-dialog" );

        // Add a keyboard shortcut to the show filter dialog action

        actions.lookup( "show-filter-dialog" ).shortcut = "Ctrl+Alt+F";

        actions.update( "show-filter-dialog" );

        // Add new actions, either singularly passing in an actions object as shown here, or in

        // multiple by passing an array of action objects

        actions.add( {

            name: "my-action",

            label: "Hello",

            action: function( event, focusElement ) {

                alert( "Hello World!" );

            }

        } );

        actions.update("my-action");

        console.log(actions);

        g=actions;

    };

    return options;

}

Any ideas? Thanks

Comments
Post Details
Added on Oct 31 2018
17 comments
3,619 views