Skip to main content
Announcements
Live today at 11 AM ET. Get your questions about Qlik Connect answered, or just listen in. SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
JohanW
Partner - Contributor II
Partner - Contributor II

Qlik Sense exportImg not working?

I’m trying to export an image from a Qlik Sense mashup using the Visualization API ( viz.exportImg ).

It works but only for the very first app you open “AppA”, see example code below.

If you open another app ,”AppB”, before the first one the image export fails with error code: 2 (I have not found any documentation for what error code 2 means by the way).

If you however open the second app “AppB” after the first one “AppA” exporting images works but only ever for the first opened app. The “currApp” API call seems to follow this pattern, it only ever returns the first opened app.

Data export seems to work regardless of opening sequence.

Is this the expected behavior or is there a way to change the “active” app??

Example code:

var prefix = window.location.pathname.substr( 0, window.location.pathname.toLowerCase().lastIndexOf( "/extensions" ) + 1 );
var config = {
    host: window.location.hostname,
    prefix: prefix,
    port: window.location.port,
    isSecure: window.location.protocol === "https:"
};
require.config( {
    baseUrl: ( config.isSecure ? "https://" : "http://" ) + config.host + (config.port ? ":" + config.port : "") + config.prefix + "resources"
} );

require( ["js/qlik"], function ( qlik ) {
    qlik.setOnError( function ( error ) {
        $( '#popupText' ).append( error.message + "<br>" );
        $( '#popup' ).fadeIn( 1000 );
    } );
    $( "#closePopup" ).click( function () {
        $( '#popup' ).hide();
    } );

    //callbacks -- inserted here --
    //open apps -- inserted here --
    
// var AppB = qlik.openApp('SimpleAppB.qvf', config); // If i comment this line in the export stops working??? Why???
 
    var AppA = qlik.openApp('SimpleAppA.qvf', config);
 
// var AppB = qlik.openApp('SimpleAppB.qvf', config); // Opening AppB here does not affect AppA export

    //get objects -- inserted here --
    AppA.getObject('QV01','Rwgz');

    var CurrApp = qlik.currApp(this);   // <- Allways returns the first opened app (see above)
    console.log('CurrApp is: ', CurrApp);

    var Imgsettings = { format: 'png', height: 300, width: 600 };
    var Datasettings = { format: 'OOXML', state: 'A' };

    AppA.visualization.get('Rwgz').then(function(vis){
        vis.exportImg(Imgsettings).then(
            function (success) {
            console.log('Image download link: ', success);
        }, function (error) {
            console.error('Image export error: ' , error);          
        });

        vis.exportData(Datasettings).then(
            function (success) {
            console.log('Data download link: ', success);
        }, function (error) {
            console.error('Data export error: ' , error);           
        });
     });
} );
Labels (4)
11 Replies
Aiham_Azmeh
Employee
Employee

Hi @JohanW ,

It looks like a bug, Qlik Sense Client (the dashboard) does have support for multi apps, like in mashups - and my guess is as you mentioned, somewhere deep in the code, we are using currentApp() which can cause this problem.

What Qlik Sense version are you using?

 

JohanW
Partner - Contributor II
Partner - Contributor II
Author

Hi Aaz,

I'm running Qlik Sense Desktop June 2019 (13.32.2)

Aiham_Azmeh
Employee
Employee

Unfortunately there is no good workaround for this... but, It looks  this have been fixed in later version of Qlik Sense - can't say for sure, maybe for September version maybe after September.

You could try sequence the calls: open App B => do your export => close App B => open App A = export => close App A.

 

I hope this helps

JohanW
Partner - Contributor II
Partner - Contributor II
Author

Thanks, guess I’ll have to wait for the fix.

I have tried sequencing the calls but with the same result. Closing the app does not seem to matter, you can still only export from the first app.


Anyway, thanks for your help.

CraigB
Partner - Contributor III
Partner - Contributor III

Hi Aaz or others:

 

I am working with my product development in my company. Can you please tell me where September NPrinting 2019 release is located, if it has been officially released? I need some fixes for an upcoming demo. Many thanks!

 

 

Regards,

Craig Bolton

Aiham_Azmeh
Employee
Employee

Hi @CraigB ,

September Nprinting 2019 hasn't been released yet, you can expect the GA in a couple of weeks.

CraigB
Partner - Contributor III
Partner - Contributor III

Hi Aaz:

 

Can you think of a work around to show publishing reports? My scenario is: I built a custom A/R report by sales rep

and other factors, and I want to show publishing reports by sales reps. Thank you for your feedback and assistance.

 

 

Best Regards,

Craig Bolton

CraigB
Partner - Contributor III
Partner - Contributor III

Hi Aaz:

 

Thank you for the follow up!

 

 

Best Regards,

Craig Bolton

will_br
Contributor III
Contributor III

Hi @Aiham_Azmeh, I'm still seeing this bug on the Qlik Sense April 2020 Patch 1 - 13.72.4 release.

Attached you can see the steps you suggested before.

Is there an open bug for this and can I follow it somehow?

--

just to be clear:

Open App A => Export (ok) => Close App A => Open App B => Export (fails) => close App B.

Open App B => Export (ok) => Close App B => Open App A => Export (fails) => close App A.