Qlik Community

Qlik Sense Integration, Extensions, & APIs

Discussion board where members can learn more about Integration, Extensions and API’s for Qlik Sense.

Not applicable

Qlik Sense - Retrieve text from text & image object embedded in mashup

Hi all,

I currently have a text and image object embedded in my mashup. 

Capture.PNG

My goal is to retrieve the text value from the text and image object and insert it into a prompt box so that a user can change the text and feed it back into the Qlik object.

This post is highly relevant but is unfortunately directed towards Qlik View instead of Qlik Sense.

GetText from TextBox via Javascript API

Any hints/tips will be highly appreciated!

Thanks in advance.

Cheers,

Joel

1 Solution

Accepted Solutions
erik_wetterberg
Honored Contributor

Re: Qlik Sense - Retrieve text from text & image object embedded in mashup

Hi Joel,

the best way to get the data is to use the model. Code snippet for this:

app.getObject('QV01','xCfgTh').then(function(model){

//data will be in model.layout

  //if you want to be notified when data changes, you can use the Validated notification:

model.Validated.bind(function(){

   //updated data in this.layout

});

});

To actually modify the text you would use the applyPatches(patches, softPatch) method, also available on the model object. The softpatch parameters allows you to make changes that are only temporary and do not affect other users.

I showed this at Qonnections, and the demo I used then is available at Qlik Branch.

Hope this helps!

Erik Wetterberg
https://extendingqlik.upper88.com/
4 Replies
erik_wetterberg
Honored Contributor

Re: Qlik Sense - Retrieve text from text & image object embedded in mashup

Hi Joel,

the best way to get the data is to use the model. Code snippet for this:

app.getObject('QV01','xCfgTh').then(function(model){

//data will be in model.layout

  //if you want to be notified when data changes, you can use the Validated notification:

model.Validated.bind(function(){

   //updated data in this.layout

});

});

To actually modify the text you would use the applyPatches(patches, softPatch) method, also available on the model object. The softpatch parameters allows you to make changes that are only temporary and do not affect other users.

I showed this at Qonnections, and the demo I used then is available at Qlik Branch.

Hope this helps!

Erik Wetterberg
https://extendingqlik.upper88.com/
Not applicable

Re: Qlik Sense - Retrieve text from text & image object embedded in mashup

Hi Erik,

Thanks for the help!

I am getting very close as I am able to modify an extension using the applyPatches method.  The only problem is that for a text and image object, I am not sure on the value I need to use for the "qPath" component. 

Using chrome inspect element, I can see that my text value is being stored under VisualisationObject --> layout --> markdown. 

Could you please advise?

Cheers,

Joel

erik_wetterberg
Honored Contributor

Re: Qlik Sense - Retrieve text from text & image object embedded in mashup

Hi Joel,

Try with '/markdown'. Not that a string value needs to be enclosed in ".

Erik

Please mark the appropriate replies as correct or helpful so our team and other members know that your question has been answered to your satisfaction.

Erik Wetterberg
https://extendingqlik.upper88.com/
Not applicable

Re: Qlik Sense - Retrieve text from text & image object embedded in mashup

That worked!

Thanks again Erik.

Community Browser