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

Iterating over multiple selected values in a textbox

Hi guys

I got a question and was wondering if you could help me out.

So users can select the month or multiple months to display data but months are in short form (field: Month, standardised way of working in company). I want to display the full name when they select a month in a textbox and this worked quite well:

=if(GetSelectedCount(Month)>1, 'Select 1 month', 'Results '&pick(MonthNum,'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'))

So when a user clicks on jan, they get 'Results January'. If they select multiple months, they get 'Select 1 Month'.

So far so good.

Now I want to be able to display multiple months. You could do this if you have the correct field (the long month names) by using concat and getfieldselections(long month names) but this needs to be adjusted in the script. Is there a construction possible where I can transform the more than 1 selected values, into the long name? 

In Excel this would now be possible given the new 'array spill' formules for example (in the past this would not have worked I think and only have given the first month with CTRL+SHIFT+ENTER).

BrentSmits_0-1619435551164.png

Which would result in 'January,  April'.

You could even generalise this construct: is it possible to transform multiple selected values and have multiple outputs (concat) in a textbox?

Thanks in advance! 

Kind regards

Brent

1 Solution

Accepted Solutions
marcus_sommer

I think a translation like you describe it isn't possible - at least not without rather complex constructs. But IMO this isn't really needed - at first why not just using the fields you want to display? And beside this you may just load multiple parallel month-fields in short, long, numeric, various formatting, what ever ... and then you could use any of them within the concat().

- Marcus 

View solution in original post

2 Replies
marcus_sommer

I think a translation like you describe it isn't possible - at least not without rather complex constructs. But IMO this isn't really needed - at first why not just using the fields you want to display? And beside this you may just load multiple parallel month-fields in short, long, numeric, various formatting, what ever ... and then you could use any of them within the concat().

- Marcus 

BrentSmits
Contributor II
Contributor II
Author

Hi Marcus

I expected something like this and specifically mentioned no changes to the script ;). I know I can do this and that is also the way I'll go but my general case was the one that needed to be answered and you did (not possible unless rather complex). So for this case it was not needed but there might be cases where you want to have an on the fly solution not in the script and then you can't progress.

Thanks for the reply!