Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello... Can anyone explain how this formula is working:
=
maxstring(if(Dimensions='Product',Dimensions,null())) & ':' &
maxstring(if(Dimensions='Source',Dimensions,null())) & ':' &
maxstring(if(Dimensions='Team',Dimensions,null())) & ':'
Basically Dimensions is an inline table with 3 entries (Product, Source and Team).
I've set Dimensions up as the source for a list box and want to achieve a string showing all items selected in the list box seperated with a colon.
This all works fine... but I just don't understand how it works... I've tried breaking it down into parts but none of this seems to make sense!?!
Many thanks! Mike
Hello,
maxstring( if(Dimensions='Product',Dimensions,null() ) )
repeat above for the other if()-statments.
BUT there is an alternative:
='Selections for Dimensions: ' & getfieldselections(Dimensions))
Or the John Witherspoon Version I found in this formu a while ago: (Thanks John!)
='Selections for VDatum:
' & if(max(VDatum)-min(VDatum)+1=getselectedcount(VDatum),min(VDatum) & ' - ' & max(VDatum),getfieldselections(VDatum))
Hi Roland, thanks for the reply...
Some things I'm still unsure about...
1 - If I remove the maxstring function the formula just returns " - "
2 - Also if I do a simple formula like: =if(Dimensions = 'Product', 'Product Selected','Product Not Selected')
this evaluates as I'd expect when I select Product from the list box but when I
select Product and another item the if statement evaluates as 'Product Not Selected'
I've attached a sample doc if that helps understand...
Cheers, Mike
Hi Mike,
look at my little application and play with it. The most exciting question is the returnvalue of Maxstring() in combination with a nested if() and NO selection:
in a text object.=maxstring( if(Dimensions='Product', Dimensions, null()) )
Even when QV-help says "These functions can only be used on fields in chart expressions." Is it a bug or a feature?
Regards, Roland
Hum... very strange...
Thanks for your extra comments... so now I can understand that when multiple items are selected in the list box, then displaying 'Dimensions' in a text box is impossible due to the multi-valued nature. If only one item is selected then a text box will display the single result.
So if I select all three items in the list box (Product, Source and Team) then this code:
=':' &maxstring( if(Dimensions='Product',Dimensions,null())) & ':'
& maxstring(if(Dimensions='Source',Dimensions,null())) & ':'
& maxstring(if(Dimensions='Team',Dimensions,null())) & ':'
returns " :Product:Source:Team: " but I would have thought it shoud return " :Team:Team:Team: " because the 3 if statments would each return a list of the 3 selected items and 'Team' is the maxstring for each of the 3 if statement results ?!?
Hi Mike,
yes, the behaviour the combination maxstring() and a nested if() is strange. I will ask our technical QT-rep. for an explanation.
RR
Let me help you simplify - instead of multiple MaxString, try function CONCAT() :
CONCAT(Dimensions, ';')
You'll get a list of all "possible" (selected or associated) Dimensions separated by semicolon.
Hi Oleg,
thanks for your reply. The main questions is: Why does the following expression in a textbox show 'Product' when nothing is selected .
=maxstring( if(Dimensions='Product', Dimensions, 'null()')
In my mind the if() has to return 'null()'. And maxstring of null() is what? For testing look into my little app above.
RR
And I'd like to know why that line would return 'Product' even if 'Team' is also selected... as "Team" would 'greater than' "Product" in a maxstring function...
CONCAT(Dimensions, ';')
also shows all items if none are selected...