Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Embed Mashup in Web Page

Hi All,

I am new to qlik sense. I currently make use of the desktop version. I created some charts and embeded them in a mashup that I created from scratch. I tried to include it in a webpage, and was successful in doing that. The challenge I now have has to do with selection. The chart is being populated by some site data. In my web page, there is a user login, and once a user logs in, it shows only details and sites of that user. I however want to restrict the sites populating these charts in the mashup based on the user login, but I am unable to do so. I am not sure if I need to do it from the web page programming side or from the qlik sense workbench. I have tried to use the select method (App.field.Select) but all to no avail. I would appreciate your help on this. I have also tried to pass session values from my web page through the link in the Iframe, but these all don't work.

Thanks.

Kunbi.

1 Solution

Accepted Solutions
Aiham_Azmeh
Employee
Employee

Hi Adekunbi,

If I understood you well, you're trying to show same mashup (in an iframe) with different selection for each type of user logged in?

- try to parse a parameter in the iframe specific to this group of users then in your mashup js catch this parameter (see below) and apply different selections in an if statement.

function getURLParameter( name ) { return ( RegExp( name + '=' + '(.+?)(&|$)' ).exec( location.search ) || [null, null] )[1]; }

hope it helps,

aiham

View solution in original post

36 Replies
Not applicable
Author

I think that kind of capability is only applicable to Qlik Sense Server and not the desktop version.

Anuj

Not applicable
Author

Okay. Thanks. If you have a sample of how that can be done on the server, can you please post it. However, I am still looking out for more feedbacks.

Not applicable
Author

Hi All,

I am still looking for a solution or advice to the above question.

Thanks.

Aiham_Azmeh
Employee
Employee

Hi Adekunbi,

If I understood you well, you're trying to show same mashup (in an iframe) with different selection for each type of user logged in?

- try to parse a parameter in the iframe specific to this group of users then in your mashup js catch this parameter (see below) and apply different selections in an if statement.

function getURLParameter( name ) { return ( RegExp( name + '=' + '(.+?)(&|$)' ).exec( location.search ) || [null, null] )[1]; }

hope it helps,

aiham

Not applicable
Author

Hi Aiham,

Thanks so much for the reply. I did pass a parameter via the Iframe like this

<IFRAME SRC="http://localhost:4848/extensions/TestOptions/TestOptions.html?extension=TestOptions&ClientLogin=$_Se...["userName"]" WIDTH=1130 HEIGHT=420 >
</IFRAME>

and in the javascript I used a I don't know how to get this username that I have passed. I checked your js code but don't understand how it should work.

Thanks.

Aiham_Azmeh
Employee
Employee

In your mashup use :

var currentUser = getURLParameter('ClientLogin');//<- you're actual parameter

[...]

then maybe

[...]

switch(currentUser){

     case 'userX':

     //do selections

     break;

     case 'userY':

     //do selections

     break;

     default:

     //do something else

     break;

}

Hope that helps,

aiham

Not applicable
Author

Yes. Thank you that really really helped and I got it working. If I may add to my question. Is it possible to have the mashups in different pages but still be affected by the first selection in the first page?

Thanks so much.

Aiham_Azmeh
Employee
Employee

It's somehow possible with the identity parameter. see http://community.qlik.com/message/728056#728056

var config = {

     host: window.location.hostname,

     prefix: "/", port: window.location.port,

     isSecure: window.location.protocol === "https:",

     identity:"my_personal_key"

};

if you use identity in your first mashup, the selections will be shared on all other mashups with same config identity.

aiham

Not applicable
Author

Thanks so much. I got it working.