Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements
QlikView Fans! We’d love to hear from you.
Share your QlikView feedback with the product team… Click here to participate in our 5-minute survey.
Rules, plus terms and conditions, can be found here.
Not applicable

Variable as a Dimension ( or Variable Dimension)

Hi!

I'm struggling trying to know why this happens:

Dimension (Option A): =if(SupContrato > 26000 , SupContrato, null())

Dimension (Option B): =if(SupContrato > $(Rango4), SupContrato, null())

Option A works perfectly: it lists only the contracts which have a surface higher than 26.000sqm

Option B: I change the 26000 for a variable that I declare within the script:

Set Rango4 = 4*(max(SupContrato)/5); but it does not work because it gets null for everything.


Many thanks for any help

Tags (4)
1 Solution

Accepted Solutions
kuba_michalik
Contributor III

Re: Variable as a Dimension ( or Variable Dimension)

I think you want that variable calculated globally, not in place when defining the dimension. Put an extra equal sign in front of it:

Set Rango4 ==4*(max(SupContrato)/5);

This will store the equal sign in the variable definition, so it will be calculated like any other variable which begins with =

5 Replies
martinpohl
Valued Contributor II

Re: Variable as a Dimension ( or Variable Dimension)

You defined Rango4 by set, so there is a formula, not a value in.

Therefor you need to calculate the variable in the definition

Use

Dimension (Option B): =if(SupContrato > $(=Rango4), SupContrato, null())

Regards

stigchel
Honored Contributor

Re: Variable as a Dimension ( or Variable Dimension)

Try

$(=Rango4)


The = sign means evaluate the next expression, without text is assumed

kuba_michalik
Contributor III

Re: Variable as a Dimension ( or Variable Dimension)

I think you want that variable calculated globally, not in place when defining the dimension. Put an extra equal sign in front of it:

Set Rango4 ==4*(max(SupContrato)/5);

This will store the equal sign in the variable definition, so it will be calculated like any other variable which begins with =

Not applicable

Re: Variable as a Dimension ( or Variable Dimension)

Thanks Martin! But it does not work neither, I have try that already.

I have also tried to make a LET instead of a Set, but nothing.

Also to declare another variable: Rango4Bis which calls the variable Rango4...nothing neither.

Also to insert the formula of the variable within the dimension instead of the variable...nothing

The only thing that works is to put a figure, not a formula or variable.

It does not make sense to me...any other suggestion?

Many thanks in advance.

BQ.

Borja Quintero.

CBRE Spain. GCS.

Architect.

+34670899622

De: Martin Pohl

Enviado: Friday, October 24, 2014 10:43 AM

Para: Quintero, Borja @ Madrid

Asunto: Re: - Variable as a Dimension ( or Variable Dimension)

Qlik Community<http://community.qlik.com/>

Variable as a Dimension ( or Variable Dimension)

reply from Martin Pohl<http://community.qlik.com/people/MartinPohl?et=watches.email.thread> in Scripting - View the full discussion<http://community.qlik.com/message/640918?et=watches.email.thread#640918>

martinpohl
Valued Contributor II

Re: Variable as a Dimension ( or Variable Dimension)

to check the value of the variable create a straight table chart with the formula from the dimension and check the result by mouse over

Regards

Community Browser