Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

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
Employee
Employee

Re: Embed Mashup in Web Page

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

35 Replies
Not applicable

Re: Embed Mashup in Web Page

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

Anuj

Not applicable

Re: Embed Mashup in Web Page

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

Re: Embed Mashup in Web Page

Hi All,

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

Thanks.

Employee
Employee

Re: Embed Mashup in Web Page

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

Re: Embed Mashup in Web Page

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.

Employee
Employee

Re: Embed Mashup in Web Page

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

Re: Embed Mashup in Web Page

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.

Employee
Employee

Re: Embed Mashup in Web Page

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

Re: Embed Mashup in Web Page

Thanks so much. I got it working.