Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

informaticaeuro
New Contributor

Use of Variable

Good afternoon!

I had been doing my first steps with Qlik Sense this week but I have a error when I use a variable and I don't understand the reason.

I have these variables:

LET numMutues = Count(nomMutua);

LET rangs = Floor(255/numMutues);

And my Load is here:

MutuesRGB:

LOAD ApplyMap('mMutues', "ID", 'No informado') as mutua,

$(rangs) as ValueRanged

FROM  [$(vPathQVD)Mutues.qvd](qvd);

How Can I use the variable into the "Load"?

Thanks for the help!

3 Replies

Re: Use of Variable

What error are you getting ?

From quick look though, it appears you are not using a Qlik Sense data connection in your FROM bit, but using the QlikView explicit path method.

Re: Use of Variable

None of your displayed variables are used within the load and they won't work in this way either - starting with LET and assigning then an aggregation-function. Here you will find many valuable informations about Variables.

- Marcus

radoresky
Contributor

Re: Use of Variable

Hi,

I guess what you need is to do this:

SET numMutues = 'Count(nomMutua)'; // SET function defines a string which can be used in the script, you must use single quotes in this case.


SET rangs = 'Floor(255/$(numMutues))'; // dollar sign is needed to exchange the variable name by its content

But you will need to add a GROUP BY statement after FROM in your LOAD script, because you are using the Count() funcion. So something like this:

MutuesRGB:

LOAD ApplyMap('mMutues', "ID", 'No informado') as mutua,

$(rangs) as ValueRanged

FROM  [$(vPathQVD)Mutues.qvd](qvd)

GROUP BY "ID";


I do not completely understand what you want to achieve but hope this helps.


Regards,

Radovan

Community Browser