Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
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
ErikWetterberg

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!

View solution in original post

4 Replies
ErikWetterberg

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!

Not applicable
Author

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

ErikWetterberg

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.

Not applicable
Author

That worked!

Thanks again Erik.