Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
carolin01
Luminary Alumni
Luminary Alumni

SubStringCount(Concat

Hello together,

I´m trying to show some expressions in my chart only conditionally. Therefore I created in my script a table that I use in a list box:

LOAD * INLINE [_DisplayChartReference, _references
    1, Plan,
    2, YTD,
    3, Outlook,
]
;

Now my expression in my chart has the following condition:

SubStringCount(Concat(_DisplayChartReference, '|'), 1)

I also tried:

SubStringCount(Concat(_references, '|'), 'Plan')>1,1,0)

But both doesn´t work. I already created a self report with a pivot table. Here this worked well and therefore I don´t understand what I´m doing wrong?

Many thanks for your help 🙂

Best regards,

Carolin

1 Solution

Accepted Solutions
Gysbert_Wassenaar

Perhaps: SubStringCount(Concat(_DisplayChartReference, '|'), '1')

The second won't work without an if:

=if(SubStringCount(Concat(_references, '|'), 'Plan')>1,1,0)


talk is cheap, supply exceeds demand

View solution in original post

6 Replies
Gysbert_Wassenaar

Perhaps: SubStringCount(Concat(_DisplayChartReference, '|'), '1')

The second won't work without an if:

=if(SubStringCount(Concat(_references, '|'), 'Plan')>1,1,0)


talk is cheap, supply exceeds demand
sunilkumarqv
Specialist II
Specialist II

try this

In the dimension properties, check the option for “Enable Conditional” and enter the following code

You will want to add similar code to each dimension, changing the letter to correspond with what you used in your inline table.


=SubStringCount(Concat(_references, '|'), 'Plan')


The last thing to do is add a Calculation Condition to the general tab of the object so that the object only displays when at least one dimension and expression is selected:

GetSelectedCount(_DisplayChartReference)>0 AND GetSelectedCount(_Expression)>0

simondachstr
Luminary Alumni
Luminary Alumni

This document I wrote on substringcount could be useful for your implementation:

http://community.qlik.com/docs/DOC-5841

carolin01
Luminary Alumni
Luminary Alumni
Author

Thank you both, both worked well. Maybe you could help me with another question:

My list box has got three values that I will connect to the expressions:

Plan, YTD and Outlook

Right now, if nothing is selected then all three expression appear. I would like to have the oposite: Only if Plan, YTD or Outlook is selected the expression should appear. Is this possible?

Gysbert_Wassenaar

Sunil already posted the answer to that in his last post. You can use the getselectedcount function for that.


talk is cheap, supply exceeds demand
carolin01
Luminary Alumni
Luminary Alumni
Author

Sorry right, I see. Thank you