Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
spetushi
Creator
Creator

Select In Field - Alternate State - Button

Hi All,

I have a field with string values with non-alphabetic characters, Product Name. Using OnSelect trigger and alternate state I can apply the same selections from Product Name (<inherited>) to Product Name (State B). I am not able to do the same by using a button action.

I have tested the following two approaches in the Search String:

approach1-  ='('&GetFieldSelections([ProductName],'|')&')'

approach2-  ='("' & getFieldSelections([Product Name], '"|"') & '")'

I have attached a sample qvw as well for ease of testing.

SelectInField.PNG

Thanks,

Sokol

1 Solution

Accepted Solutions
sunny_talwar

Try with this expression:

= '("' & getFieldSelections([ProductName], '"|"', 10000, '$') & '")'

View solution in original post

8 Replies
sunny_talwar

Try with this expression:

= '("' & getFieldSelections([ProductName], '"|"', 10000, '$') & '")'

spetushi
Creator
Creator
Author

Thank you for the prompt response Sunny!

Yes, this works and I would have not guessed the "10000, '$'" tweak. Could you please explain how the '10000' and the '$' does tte magic?

Best,

Sokol

sunny_talwar

Make sure to increase or decrease 1000 based on your requirement. Read about the role of 1000 here:

GetFieldSelections ‒ QlikView

Not applicable

You can try with Concat Function instead of getfieldselections. If you select all it show ALL I guess.

spetushi
Creator
Creator
Author

Thank you Sunny, works as expected

sunny_talwar

I don't really know why it works this way, but the issue seems to be related to the fact that you were triggering a select in field action on an Alternate State

Capture.PNG

Since the trigger was in alternate state, it was picking the selection in the alternate state as well using  GetFieldSelections([ProductName], '"|"').Now in order to specify state in GetFieldSelections() you can use the fourth parameter to do that. Help section doesn't disclose that, but starting SR 8, some functions which did not take state information allowed to specify alternate state

Capture.PNG

Use of 1000 was arbitrary but its significance is that if you have a lot of values to select from, GetFieldSelections() will only them listed out until you have less values selected (I think the number is 5 or 6 by default, but have not tested it out) and as soon as the number increases it starts doing NOT or some other thing. With specifying 1000, I told GetFieldSelections() to list out values until 1000 selections. For your situation it will depend on how many selections are possible by user. You might want to make it 10 or 10,000 based on your requirement.

Hope this all would make it clear

Anonymous
Not applicable

spetushi
Creator
Creator
Author

Thank you Sunny