Qlik Community

QlikView Creating Analytics

Discussion Board for collaboration related to Creating Analytics for QlikView.

Highlighted
kristof_j
Contributor II

variable with comma parameter

Hi all

I wanted to use a variable with parameter and use 'total' as parameter. Like this expression

$(eCountDistinct( total ))

So far so good.

When I want to expand the total with 2 parameter like 'total <product_level1, product_level2>' the comma is interpreted as the end of the variable parameter.

The following examples don't work:

  • $(eCountDistinct( total <product_level1, product_level2> ))
  • $(eCountDistinct( 'total <product_level1, product_level2>' ))
  • $(eCountDistinct( "total <product_level1, product_level2>" ))

How can I solve this?

Tags (2)
1 Solution

Accepted Solutions
MVP & Luminary
MVP & Luminary

Re: variable with comma parameter

In general that's possible - you could replace everything with the parameters but you must be careful how to declare the various parameters and how they are then processed within the variables. If you want to replace nearly everything with multiplen dimensions within totals and set analysis and something more then you will need some efforts to build a stable logic and to find the right syntax for each type.

I think this will be helpful for you: (and read the comments, too)

Variables

Re: nested variable troubles

Comma problem (,) workaround for dollar sign expansion with parameters

- Marcus

22 Replies
MVP
MVP

Re: variable with comma parameter

Did you try enclosing the parameter with quotes?

$(eCountDistinct(' total <product_level1, product_level2> '))

or

$(eCountDistinct(" total <product_level1, product_level2> "))

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
kristof_j
Contributor II

Re: variable with comma parameter

I tried that but I didn't work.

Does it work with you?

Re: variable with comma parameter

See if this helps:

eCountDistinct

count(DISTINCT $1, $2  customer)

eExpression

$(eCountDistinct($(vParameter)))

vParameter

1) TOTAL <product_level1,>

2) TOTAL <product_level1, product_level2>

Re: variable with comma parameter

eCountDistinct -- count(DISTINCT $1 customer) -- Here , what you want to achieve

vParameter -- total <product_level1> -- Is that is Garbage error(What is the mean of set expression)

Before develop something, think If placed (The Right information | To the right people | At the Right time | In the Right place | With the Right context)
MVP
MVP

Re: variable with comma parameter

No, I have never had this problem, so it was just my 2c worth

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
antoniotiman
Honored Contributor III

Re: variable with comma parameter

Why not

kristof_j
Contributor II

Re: variable with comma parameter

This is a step forward.

But I still experience some difficulties when I want 3 or more parameters in the total.

I wanted to use this method for some expressions that have 5 dynamic parameters in the total.

vinieme12
Esteemed Contributor II

Re: variable with comma parameter

see attached

kristof_j
Contributor II

Re: variable with comma parameter

I wanted to use a variable with a parameter so that I can use this for several expressions with different totals.

In this way I have 1 expression to maintain and other expressions that use that one expression with different totals.

I used vParameter just to make it more easy to make changes if you guys wanted 🙂

Your sollution would be plan B.

I thought I could make it more elegant 🙂