Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello,
I have a pivot table where i want to know the name of the first dimension ( Item Desc in the exemple below) so that i can store it in a variable. For exemple if the first dimension is Item Desc then my variable need to return Item Desc. If the user is moving Product Group as the first dimension then the variable need to return now Product Group.
Thanks.
I think @Or means something like:
=if( $(vToggle) = 'Item Desc', [Item Desc] ,
if( $(vToggle) = 'Product Group', [Product Group], [Customer]))
or instead of using Strings in the toggle variable I would probably use numbers:
=if( $(vToggle) = 1, [Item Desc] ,
if( $(vToggle) = 2, [Product Group], [Customer]))
As far as I know, you can't do that directly (perhaps through Automation in SaaS? Not sure). Otherwise you'd have to do it the other way around - create a calculated field that changes based on the selected variable.
as @Or mentioned, I don't think you can do that outside of the context of the pivot table.
However within the pivot table you can use the function getObjectField(0) to get the name of the first Dimension used.
Thanks do you have an exemple I am not sure to understand what you mean about the calculated field.
I think @Or means something like:
=if( $(vToggle) = 'Item Desc', [Item Desc] ,
if( $(vToggle) = 'Product Group', [Product Group], [Customer]))
or instead of using Strings in the toggle variable I would probably use numbers:
=if( $(vToggle) = 1, [Item Desc] ,
if( $(vToggle) = 2, [Product Group], [Customer]))
Thanks and what does $(vToggle) correspond to. I dont see to what i need to link it.
First you need to create the variable vToggle in the script:
Let vToggle = 1;
Then you can use the variable input Object or normal buttons to switch the value of the variable.
The user can then click on one of the Dimensions, the variable will change, and therefore your first Dimension in the pivot table will show accordingly.
Okay so in the Properties of the table in Show column if: i link the display of the column with the number select in $(Toggle). So if i select the button Item Desc it will display as the first dimension and then if i select after also Product Group it will be second dimension.
The problem is i can only select on value with a button switch so i can't display more than one column in the pivot table like that? And also if the user select more than one things how to keep track what value was the first select in $(Toggle) because Qlik is ordering values?
That's why you should rather use the variable input Object.
This will allow you to toggle between the different values, and only allows the user to apply one value to the variable.
Also don't use the show hide functionality for the first Dimension of the pivot table. There you want to use the calculated Dimension as i mentioned above. Then you can have 2 more calculated Dimensions after, which always show the opposite dimensions of the first one.
For example: If the user wants the Item Desc to be first he selects the button in the variable input. Then the first calculated dimension will show the Item Desc. The second calculated dimensions will show the product group for example and the third will show the customer.
Thanks i think i understand the idea behind , the only what is still blurry is where inside the pivot table my $(Toggle) is used in order it switch the select dimension as first dimension according to selection in the variable input.