Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello.
I want to create radar chart where I will be able to change expression using system table "$Field".
So I've created Listbox with system fields. Then I've created Variable vFieldSelection "='['&[$Field]&']'".
And now I've created expression in chart like that "Sum ($(vFieldSelection))".
And everything is fine when I want to show only 1 expression from 1 selected field.
But when I select more then 1, there is no data.
I want to create more expressions for chart using next selected items.
Is there any way to get first selected field to variable, then second selected item to variable etc. so I will be able to add more expressions for next variables?
Here we go..
use the getSelectedCount(field) to know how many values selected
and use concat function to display selected values
concat(Distinct field , ',')
You can use GetFieldSelections() with a separator like:
vAllFields=GetFieldSelections([$Field] , ';')
this will generate a string like: 'Field1;Field2;Fiel3' .
Then separate the sting out using SubField() like:
vField1=SubField('$(vAllFields)' , ';' ,1)
vField2=SubField('$(vAllFields)' , ';' ,2)
vField3=SubField('$(vAllFields)' , ';' ,3)
Hi Maciej,
I have done a similar chart with this:
Dimension:
$Field
Expression1:
$(=concat('if($Field=' & chr(39) & $Field & chr(39) & ',sum([' & $Field & '])', ',') & concat(right($Field&')',1)))
Expression2:
$(=concat('if($Field=' & chr(39) & $Field & chr(39) & ',count([' & $Field & '])', ',') & concat(right($Field&')',1)))
However, this shows all fields if no selection is made.
- Ralf
Hi, when I put directly function GetFieldSelections([$Field] , ';') to textbox expression, I get nice list with field names.
But when I set it to variable, then I get information: Error: Garbage after expression: "asd". I assume that's why I have space in names. How can I pass that?
EDIT: Ok it was garbage expression, because I've tried to see this in textbox like that "=$(vAllFields)", but when I've typied "=vAllFields" I got correct value.
But now functions for vField1 and other are not working. I've tried "Sum($(vField1))" and Sum(vField1) and it doesn't work 😞
Hi Ralf,
Thanks, but it also only works when I have 1 selection.
Works on my site with a listbox on $Field...
Try :
=$(='Sum('&'$(vField1)' &')' )
Or,
=$(='Sum('&'$(=vField1)' &')' )
Fields var:
vAllFields =GetFieldSelections([$Field],',')
I've tried for vField1
=SubField('$vAllFields', ';' ,1)
=SubField($vAllFields, ';' ,1)
=SubField('vAllFields', ';' ,1)
=SubField(vAllFields, ';' ,1)
=SubField($(vAllFields), ';' ,1)
And both expressions doesn't work 😞
Why don't you post a qvw with sample data? I guess, it's just a variable expansion issue.