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

Set field from variable

I want to save the selections in a field upon entering sheet1.  Then I want to manually change the selections in that field.  Then upon leaving sheet1 I want to restore the original selections that I saved.

I tried this by GetFieldSelections and storing the result in a variable.  These are years by the way.  This results in a comma separated list.  Then I change the years to what is appropriate for Sheet1.  Then when I leave sheet1 I want to put the original list of years that I saved back into the field.  I tried doing this by taking the comma separated list, adding leading and trailing parentheses and replaced the commas with pipes.

This doesn't work.  Does anyone have any suggestions?  Maybe a better way to be able to restore the values?

1 Solution

Accepted Solutions
Not applicable
Author

Hi Ivan,

It partially works.  Once the variable starts displaying things like "All" or "Not A" it no longer works.  I added a few rows to your example to test this out.  Is there a way to fix this?  By the way, the difference between your suggestion and what I did originally was I used "$" in front of the variable name to expand it, which didn't work.  Once I saw that you didn't have a "$" in your example, I took it out and it worked, up until the variable displayed things like Not A.

View solution in original post

12 Replies
Gysbert_Wassenaar

Create a bookmark per sheet and use the OnLeave and OnActivate sheet triggers to save (replace) the bookmark when leaving the sheet and activating the bookmark when entering the sheet.


talk is cheap, supply exceeds demand
iktrayanov
Creator III
Creator III

So this (2010|2011|2012) does not work

Try to make your search string like this (*2010*|*2011*|*2012*)

Not applicable
Author

Thanks that works.  I'm also going to try Ivan's solution to see if that will let me restore only certain fields.

Not applicable
Author

Ivan,  my search string was as you supposed.  I changed it as you suggested, but it didn't work.  When I go back to another sheet all years are de-selected.

iktrayanov
Creator III
Creator III

You may want to double check how you set your actions. It should work.

See the attached example. I created a button SetVariable that holds your selections and after changing selections another button Select that selects your saved selections. Take a look at the actions.

Not applicable
Author

Hi Ivan,

It partially works.  Once the variable starts displaying things like "All" or "Not A" it no longer works.  I added a few rows to your example to test this out.  Is there a way to fix this?  By the way, the difference between your suggestion and what I did originally was I used "$" in front of the variable name to expand it, which didn't work.  Once I saw that you didn't have a "$" in your example, I took it out and it worked, up until the variable displayed things like Not A.

iktrayanov
Creator III
Creator III

Can you attach your example?

Not applicable
Author

This is your example with a few more rows.  If I select say, all rows except A, set the variable, then make a different selection and then click Select, it doesn't use the variable.

iktrayanov
Creator III
Creator III

Sorry I know what the problem is.

I was trying something else and I forgot to remove the triggers. Go on the document properties and remove the triggers from Prod1 also go on the Select button and change the field from Prod1 to Prod2.