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: 
JustinDallas
Specialist III
Specialist III

Can't evaluate variable in NPrinting

Hello Everyone,

I've got some header text that I would like to include in an NPrinting Excel report.  It looks something like this in my Data Load section of Qlik Sense.

LET Today = timestamp(daystart(timestamp(today())) + maketime(6))

;

LET Yesterday = timestamp(daystart(timestamp(today()-1)) + maketime(6))

;

SET HeaderText = On-Time Exception Report for $(Yesterday) to $(Today)

I've tried pretty much everything including creating a variable in NPrinting and I alway get this.

Error: Garbage after expression: 'Exception'

What can I do to make my header get calculated properly.

ExpressionIssue.PNG

Any help is greatly appreciated.

1 Solution

Accepted Solutions
Lech_Miszkiewicz
Partner Ambassador/MVP
Partner Ambassador/MVP

Try This & then just use variable in your NPrinitng Template

LET Today = timestamp(daystart(timestamp(today())) + maketime(6)); 

LET Yesterday = timestamp(daystart(timestamp(today()-1)) + maketime(6)); 

LETHeaderText = CHR(39)& 'On-Time Exception Report for '& '$(Yesterday)'&' to '&'$(Today)';

np1.pngnp2.png

np2.png

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.

View solution in original post

4 Replies
RSvebeck
Specialist
Specialist

Did you try:

LET HeaderText = 'On-Time Exception Report for $(Yesterday) to $(Today)';

Svebeck Consulting AB
Lech_Miszkiewicz
Partner Ambassador/MVP
Partner Ambassador/MVP

Try This & then just use variable in your NPrinitng Template

LET Today = timestamp(daystart(timestamp(today())) + maketime(6)); 

LET Yesterday = timestamp(daystart(timestamp(today()-1)) + maketime(6)); 

LETHeaderText = CHR(39)& 'On-Time Exception Report for '& '$(Yesterday)'&' to '&'$(Today)';

np1.pngnp2.png

np2.png

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.
JustinDallas
Specialist III
Specialist III
Author

Thanks Lech,

I think the main difference is that I have "SET" where you have "LET".  Once I dropped that in using your example it worked as I expected it to.

Lech_Miszkiewicz
Partner Ambassador/MVP
Partner Ambassador/MVP

no worries,

Note also that by adding CHR(39) at the beggining of Header Text effectively we are producing string auch as:

'On-Time Exception Report for 11/05/2017 6:00:00 AM to 12:05/2017 6:00:00 AM.

The " ' " (single quote character) once moved to excel changes cell type to Text, so excel does not try to calculate formula like "=On-Time......"


hope this helps

regards

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.