Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Dynamic system fields in radar chart

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?

1 Solution

Accepted Solutions
rbecher
MVP
MVP

Here we go..

Data & AI Engineer at Orionbelt.ai - a GenAI Semantic Layer Venture, Inventor of Astrato Engine

View solution in original post

17 Replies
ali_hijazi
Partner - Master II
Partner - Master II

use the getSelectedCount(field) to know how many values selected

and use concat function to display selected values

concat(Distinct field , ',')

I can walk on water when it freezes
tresesco
MVP
MVP

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)

rbecher
MVP
MVP

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

Data & AI Engineer at Orionbelt.ai - a GenAI Semantic Layer Venture, Inventor of Astrato Engine
Not applicable
Author

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 😞

Not applicable
Author

Hi Ralf,

Thanks, but it also only works when I have 1 selection.

rbecher
MVP
MVP

Works on my site with a listbox on $Field...

Data & AI Engineer at Orionbelt.ai - a GenAI Semantic Layer Venture, Inventor of Astrato Engine
tresesco
MVP
MVP

Try :

=$(='Sum('&'$(vField1)' &')' )

Or,

=$(='Sum('&'$(=vField1)' &')' )

Not applicable
Author

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 😞

tresesco
MVP
MVP

Why don't you post a qvw with sample data? I guess, it's just a variable expansion issue.