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

Announcements
Qlik GA: Multivariate Time Series in Qlik Predict: Get Details
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Dynamically buidling columns in the straight table-duplicate columns

Hi All:

I need to build a straight table based on the user selection.

User can select/unselect measure/s from the list box (check box style) and based on the selections, columns will be added or removed from the straight table.

Based on previous posts on the community regarding this issue, i created an Inline table and then used it in the conditional section of the expression. My expression in the "conditional" tab looks

=getselectedcount ( _Measure )>0 and SubStringCount(Concat(_Measure, '|'), 'XLR')

this works fine if the value XLR is unique in the list box,

but if other values in the list box contains this word then it shows up 2 columns in the dashboard, even though user have selected one value.

i.e. if list box contains values like XLR, XLR Xigma, then my Straight table shows 2 columns(even though user selected just XLR Xigma) because XLR exist twice.

How can i build this table.

Please help.

1 Solution

Accepted Solutions
nagaiank
Specialist III
Specialist III

You are correct. I used either _Dimension or _DimensionNo to solve the problem in my application.

Using specified first and last characters in SubStringCount(Concat('^'&_Measure & '^' , '|'), '^XLR^') seems to be a good solution.

View solution in original post

7 Replies
Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

Change the substringcount part by adding an extra character that your dimension values very like won't have: SubStringCount(Concat(_Measure & '^' , '|'), 'XLR^')


talk is cheap, supply exceeds demand
nagaiank
Specialist III
Specialist III

I also had a similar problem. I solved it by defining a _DimensionNo column in addition to _Dimension and using _DimensionNo for filtering column in such cases

LOAD * Inline [

_Dimension, _DimensionNo

XLR,1

XLR Xigma,2

];

Use the condition

=getselectedcount ( _Measure )>0 and SubStringCount(Concat(_MeasureNo, '|'), '1')

Hope this helps.

Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

And then you find out you have 10 measures and... whoa! substringcount will find that both measureno 1 and 10 contain a '1' character


talk is cheap, supply exceeds demand
stabben23
Partner - Master
Partner - Master

Hi, Be aware that the No 1 and 10 or 2 and 20 and so on could show exactlly the same behavior. I usually use A,B,C,......... in the defined extra dimension. So if you have more than 10 selections use letters.

nagaiank
Specialist III
Specialist III

You are correct. I used either _Dimension or _DimensionNo to solve the problem in my application.

Using specified first and last characters in SubStringCount(Concat('^'&_Measure & '^' , '|'), '^XLR^') seems to be a good solution.

Not applicable
Author

Thanks all.

I will try the suggested solution and see if that works out.

Not applicable
Author

KrishnaMurthy/Gysbert:

Thanks for the help.

Gysbert suggestion was great but it worked only after putting special character as the first and last characters in the SubstringCount.