Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
See why IDC MarketScape names Qlik a 2025 Leader! Read more
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Integer variable in Qlikview

Hi,

How can I declare an integer variable in my script Qlikview and use this variable in a text object.

Thanks.

15 Replies
Not applicable
Author

Now, i have done like this,

LET nbMois = 45;
LET nbMois = round((Date(DateFinExercice, $(DateFormat) )-Date(DateDebutExercice, $(DateFormat) ))/30);

in text objet, i done:

= nbMois

but i have not a result

oscar_ortiz
Partner - Specialist
Partner - Specialist

Your problem may lay in your formula:

Comment out your formula just to verify that placing a 45 in your variable will actually work for you.

LET nbMois = 45;
//LET nbMois = round((Date(DateFinExercice, $(DateFormat) )-Date(DateDebutExercice, $(DateFormat) ))/30);

If the 45 displays fine for you, you'll have to check your formula.

Not applicable
Author

when i done as you, 45 displays fine.

Also, when i put this expression

= round((Date(DateFinExercice, $(DateFormat) )-Date(DateDebutExercice, $(DateFormat) ))/30);

in my text object, the good result displays 12

As i use this formula in many sheet, i would like to create a global variable.

Not applicable
Author

Try this:

create a variable with your formula:

SET vFormula=round((Date(DateFinExercice, $(DateFormat) )-Date(DateDebutExercice, $(DateFormat) ))/30);

and use it later on like:

=$(vFormula)

Cheers

Martin


Not applicable
Author

Thank you very much Martin

It works perfectly.

Can i have ur email adress.

This is mine : yimengael@yahoo.com

Not applicable
Author

Hi,

can you please verify the answer?

THX.

Why do you need my E-Mail?

Martin