Skip to main content
Announcements
Defect acknowledgement with Nprinting Engine May 2022 SR2, please READ HERE
cancel
Showing results for 
Search instead for 
Did you mean: 
jblomqvist
Specialist
Specialist

How to evaluate a variable in NPrinting?

Hi there,

I have a variable like this:

Variable name: vYear

Expression: Year(AddYears(Max(Date),-1))

When I put this Variable in NPrinting I do <vYear> it gives me the expression above, what I want is the result of the expression.

How do I do this?

7 Replies
Anil_Babu_Samineni

May be call it as [vYear]

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
Lech_Miszkiewicz
Partner Ambassador/MVP
Partner Ambassador/MVP

you need to evaluate your expression  - which means you need to have "="ign in front of your expression:

like:


Expression: =Year(AddYears(Max(Date),-1))

cheers

Lech

---------------------------------------------

When applicable please mark the appropriate replies as CORRECT. This will help community members and Qlik Employees know which discussions have already been addressed and have a possible known solution. Please mark threads as HELPFUL if the provided solution is helpful to the problem, but does not necessarily solve the indicated problem. You can mark multiple threads as HELPFUL if you feel additional info is useful to others.

cheers Lech, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful to the problem.
kdmarkee221
Contributor III
Contributor III

Can you clarify this post?  Is the logic done in the script portion and if so, what does that look like?  I'm currently picturing or assuming the variable in the script is like this:

SET vYear = Year(AddYears(Max(Date),-1));

Thanks.

kdmarkee
Specialist
Specialist

I think I figured out what was meant by the "=". I did this in the Variable editor and not the script, but maybe you can do it in both places...I'm not sure.

Lech_Miszkiewicz
Partner Ambassador/MVP
Partner Ambassador/MVP

you can do it in both places. In script however i think you will have to use LET statement and apostrophies

like:

LET vYear = '=Year(AddYears(Max(Date),-1))';

cheers Lech, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful to the problem.
kdmarkee
Specialist
Specialist

That's what I was looking for; I'll have to try that.  Thanks.

Lech_Miszkiewicz
Partner Ambassador/MVP
Partner Ambassador/MVP

see how it goes.. cheers Lech

cheers Lech, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful to the problem.