Qlik Community

Qlik Sense App Development

Discussion board where members can learn more about Qlik Sense App Development and Usage.

wangxusq
New Contributor III

Mashup get variable

Hi all,

I want to get variable value in mashup.But still failed.

2.jpg

alert : always object object.

1.jpg

I refer to the help :

https://help.qlik.com/en-US/sense-developer/September2017/Subsystems/APIs/Content/CapabilityAPIs/Var...

3.jpg

Anything wrong?

My variable vChange =1,so I want to get 1.

Thanks.

2 Replies
hacr-sds
Contributor

Re: Mashup get variable

If you look at the documentation you refer to, you notice it is returninger a promise, and not a string.

"Returns a promise of a variable model."


Searched a bit for you and found this one... maybe it'll help you:


Qlik Sense: app.variable.getContent() doesn't return the current variable value


Or this one


https://help.qlik.com/en-US/sense-developer/3.0/Subsystems/APIs/Content/MashupAPI/Methods/getContent...

eduardo_facchio
New Contributor

Re: Mashup get variable

A little later but if anyone need, just change alert to console.log  or run this for understand :

app.variable.getContent('vChange',function ( reply ){

    alert(reply); // returns [ Object Object ]

    alert(reply.qContent.qString) // returns your variable

    console.log(reply) // returns object in console (F12)

)};

Community Browser