Thanks for your answer.
But using a variable does exactly the same as if I just use the function and print the results (e.g. in a textbox).
I do, however, only need the names of the fields where selections are made. I do not want to also get the selected values.
For example if I had the fields date, product, country and type and select only a date and a country, if I use GetCurrentSelections() I get
as an output. What I want to achieve is that I only get
Using a nested Subfield() statement and GetCurrentSelections() I think you can achieve this:
Should work...but will only be good for a chart object or list box, I think. If you want a single text string for a text box or similar then try surrounding the above in a Concat() statement.
Hope this helps,
I believe the 2-parameter version of subfield won't work in the frontend, so your expression will only return one field name, not all selected.
I don't know if there is an easy way of getting just the names of fields with selected values, maybe I am just missing the right QV function. I assume you want to get your results as string in any chart object, not just using the current selections box and disable the visibility of the values, dropdown and clear symbol (in general tab).
I could think of two different 'general' approaches to create such a string, i.e. we don't want to hardcode the field names and the check on any selections in them, but we want to be flexible (allowing more fields to be added). If hardcoding is not a problem, I think we can just create an expression like
=if(GetSelectedCount(Field1),'Field1 ') & if(GetSelectedCount(Field2),'Field2 ')
(adding all fields to the expression).
The first general approach might automatically create kind of this expression as a variable in the script, maybe using a loop over all fields or a concat technique (which I haven't fully in mind yet).
The second general approach I can think of involves the use of subfield functions again and a technique to create an iterator for the third parameter. We can do it like this:
The important thing here is the ValueLoop function, which creates a loop for us when used in an aggregation function like concat, the valueloop function acts as an iterator. vFieldNum is a variable that just holds the number of fields (=count($Field) )
See also attached.
Hope this helps,
comm50720.qvw 154.2 K