Qlik Community

Ask a Question

QlikView App Development

Discussion Board for collaboration related to QlikView App Development.

Announcements
Talk to Experts Tuesday, January 26th at 10AM EST: Qlik Sense. REGISTER NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Passing value of variable

I have a list box for countries.

I want to select one country and pass the name of country to database.

How can I do it ?

My Approach:

I am taking the currently selected Country into a variable vCountry = GetFieldSelections(Country)

This shows the value correctly in the text object as vCountry showing the value of currently selected country.

But when I want to pass it further, using $(vCountry), it still passes the value as 'GetFieldSelections(Country)' and not the actual selected country.

I tried using LET in script but still it didnt work, how can I set it to StringContent.

I dont want to use macro.

Kindly help, thanks in advance

Regards

Swapneel

1 Solution

Accepted Solutions
Not applicable

Thanks for your precious support everyone.

I finally had no option, but to go for the macro approach.

Thanks again, you all have been quick at replies.

Definately count worthy people.

Thanks again.

Regards

Swapneel

View solution in original post

14 Replies
Employee
Employee

What is it you do when you "pass the name of country to database"?

Not sure what you are trying to do here, but the variable definition should be

=GetFieldSelections(Country)

where the = is part of the definition. Now $(vCountry) will return the selection.


In a set statement

Set vCountry = =GetFieldSelections(Country);


(the = = is not a typo)


HTH

Jonathan



Logic will get you from a to b. Imagination will take you everywhere. - A Einstein

Hi Swapneel, you can use:

SET vCountry = "=GetFieldSelections(Country)";

Not applicable

Hi Ruben Marin,

Thanks for the quick reply but, the solution is not working,

plz find the attached images for reference.

Thanks & Regards

Swapneel

Not applicable

HI Jonathan dienst,

thanks for replying, but it didnt work

I am attaching the images for reference.

Thanks again,

Regards

Swapneel

Not applicable

I want to achieve dynamic loading.

Regards

Swapneel

Not applicable

Hi,

You can use peek function.

LET vAB=Peek(fieldname,0,tablename);

Hi Swapneel, GetFieldSelections() won't work in script, in this case you should do a FOR bucle, ie:

FOR i =0 to NoOfRows('tablesList')-1

     LET vTable=Peek('Tables', $(i), 'tablesList');

     LOAD *;

     SELECT * FROM [DEVS_ID.$(vTable)];

NEXT

This will load all your tables wich most probably will return a mess of tables. Only way I see this working is if all the tables returned in tablesList have the same fields.

What are you trying to do?

Hi,

How your trying to read? that is user will make the selection in the front end of your dashboard and then your trying to push this to DB? if so your variable set should work. But if your trying to capture in the script then we need to think how your doing....can you please answer my questions