Qlik Community

Ask a Question

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

Announcements
QlikView forum consolidation is complete. Labels are now required. LEARN ABOUT LABELS
cancel
Showing results for 
Search instead for 
Did you mean: 
stevelord
Specialist
Specialist

Hi Gysbert and team (trigger search string for multiple values containing spaces)

Hi Gysbert and team, how do i augment this fantastic multiple values in a trigger search string solution you provided to work for fields that contain values with spaces?

https://qlikcommunity.qliktech.com/thread/63020

I banged my head over in this other thread for hours and got a solution that worked for one value, then found your solution for many values, then tripped into the issue for values with spaces...  I goofed around with replace() in the search string to no avail.

Syntax for default state listbox to cause selections in alternate state listboxes?

My hack/workaround may be to go back in the load script and use replace() there to put _ or - into the values but that may not look pretty if I do it too many places.

Also please provide a solution for any 20 other things I might discover beyond the 'values with spaces' bit if you know any of those off the top of your head.

1 Solution

Accepted Solutions
Gysbert_Wassenaar

Add double quotes around the values: ='('&Concat(Distinct chr(34) &  Name1Value  & chr(34),'|')&')'


talk is cheap, supply exceeds demand

View solution in original post

6 Replies
Gysbert_Wassenaar

Add double quotes around the values: ='('&Concat(Distinct chr(34) &  Name1Value  & chr(34),'|')&')'


talk is cheap, supply exceeds demand

View solution in original post

morganaaron
Specialist
Specialist

gwassenaar,

Could this be altered to be used inside of a set analysis expression? At the minute we have a similar concat statement inside of a set to return values based on another field, but this only works when there aren't spaces present, and lifting the idea presented above doesn't work due to (I assume) the double quotes.

The expression at the minute is: Field1={"$(='(' & Concat(Distinct Field2, '|') & ')')"}

Gysbert_Wassenaar

Yes, with something like Field1={"$(=Concat(Distinct chr(39) & Field2 & chr(39),',')"}

Note the the set is calculated at the chart level, not the row level. And the concat is calculated outside the chart context at the document level.


talk is cheap, supply exceeds demand
stevelord
Specialist
Specialist

Thanks, I will try that after I get out of some meetings and come back with correct/helpful credits and/or more questions.

PS> Sorry I didn't paste the expression in here.  I think it crossed my mind and then I became distracted about heading home for the day. (Tired and hungry when I made this thread.)

stevelord
Specialist
Specialist

Thanks Gysbert, that expression works nicely for add action OnSelect

I modified it to fit with add action OnChange like so:

='('&Concat(Distinct chr(34) &  GetFieldSelections(LastActiveYearMonth)  & chr(34),'|')&')'

(The other triggered fields only needed =GetFieldSelections(FieldName) and worked as they were since they were single word or number values.)

This works, but has a slightly odd side-effect of causing values in other fields to be de-selected or for those triggered-fields to deselect in this field when they are deselected.  It's a minor issue, because the selections all stick when you make one or many and at worst you have to re-select in other fields if you change selection in the triggered-field.  My instinct is to switch their OnChange actions to the longer/newer expression to get double quotation marks around all of the value selections in all of the triggered fields.  Is Qlikview piling the selected values up in the background someway that would be helped by that approach?

Thanks for the expression that covers all the scenarios I can think of for OnSelect.  Just feels like a step off the same conclusion for OnChange..  Maybe Qlikview 13 allows for multiple states to be assigned to objects like listboxes...

stevelord
Specialist
Specialist

So the odd phenomenon with OnChange de-selecting seems to not happen if I hold Ctrl while selecting and de-selecting, and things snap to the right position when I let go of the Ctrl key at the end.  I think this means Qlikview is holding all of the selections in a list behind the scenes and that I probably need to adjust my other OnChange search string expressions to let them interact safely with the one for multiple values with spaces.

Multi-state objects capability someday would be nice to have for bridging primary fields in different states...   (In this case my triggered fields are defining the population to be analyzed, and the alternate states relate to various activities and activity time periods.  And the final report/tables tally up how many people did which combinations of activities based on one round of selections and no excel use by end user.)