Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Not applicable

use setAnalysis on multiple fields matching wildcard mask

Hi community!

Can I use setAnalysis to Count all of the fields which match "*POST" wildcard mask and are holding value of "yes" ?

Or, can you suggest a clever way to do this?

Thank you for your insights!

9 Replies
Highlighted
Not applicable

Re: use setAnalysis on multiple fields matching wildcard mask

Please see a doc I have writtent on Set Analysis:

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

The chapters 4.2 and 4.5.2 will give you answers.

Fabrice

Highlighted
Not applicable

Re: use setAnalysis on multiple fields matching wildcard mask

Count({<Measure={'*POST','YES'}>}Measure)

Highlighted
Not applicable

Re: use setAnalysis on multiple fields matching wildcard mask

Isn't this expression counting Measure fields containing '*POST' and 'YES' strings?

I would like to count all Fields (not just current selection) which mane match '*post' wildcard holding some value, say, 'yes'...

Highlighted
Not applicable

Re: use setAnalysis on multiple fields matching wildcard mask

well, in my case, I have to match ALL FIELD NAMES to wildcard and count them if they holding value of, for example, 'yes'...

Highlighted
Not applicable

Re: use setAnalysis on multiple fields matching wildcard mask

Hi Marek, As of my understanding, you need to apply the Wildcard match on the Fieldnames.

Count( {1<*POST={'Yes'}>} FieldNameForCounting )

If you need, above type functionality, you need to create the expression dynamically ?

Please confirm this what you need ?

Highlighted
Not applicable

Re: use setAnalysis on multiple fields matching wildcard mask

dynamically in means for every row loaded.

example:    

     I have fields named as follows:

          ONE_POST

          TWO_POST

          THREE_POST

          ...

They cane have a value of yes/no. This value is changing from record-to-record while selecting them. I just need to count all of *POST records having value of 'yes'. ok?

Highlighted
Employee
Employee

Re: use setAnalysis on multiple fields matching wildcard mask

Create a variable with this

Concat({<$Field={'*POST'}>}$Field&'={"yes"}',',') and then use this variable inside your expressions

sum({<$(yourvar)>}value)

Highlighted
Not applicable

Re: use setAnalysis on multiple fields matching wildcard mask

Hi Mareck, As of my understanding , you need to have the expression dynamically like below:

Count({1<ONE_POST={'Yes'}>} ONE_POST) + Count({1<TWO_POST={'Yes'}>} TWO_POST) + ....

If you need above expression dynamically, Use Celver Anjos Method and change logic

Highlighted
Not applicable

Re: use setAnalysis on multiple fields matching wildcard mask

Hi Mareck, Please find the below expression. This expression ignores all your current selection and generate the dynamic expression. Define the below expression on UI with vDynamicExp

vDynamicExp = Concat( {1<[$Field]={'*POST'}>} 'count( {1<'&[$Field]&'={"Yes"}>} '& [$Field] &' )', ' + ')  

and call this variable $(=vDynamicExp)