Qlik Community

Qlik NPrinting Discussions

Discussion Board for collaboration on Qlik NPrinting.

cancel
Showing results for 
Search instead for 
Did you mean: 
sebastianhansso
Contributor
Contributor

Qlik Sense VARIABLE compared to NPrinting CONSTANT conditions doesn't work.

Qlik Sense August 2021 (Patch 1)

I have created a VARIABLE in Qlik Sense calculating a simple ratio between two subsets. In Nprinting I want to use that VARIABLE in a CONDITION to only publish a report if the ratio is below 98% (0,98). The reports are all filtered with values. None is in the calculation for the VARIABLE.

VARIABLE:
1-(Count({$<
Error={'Value'},
[Date.autoCalendar.MonthsAgo]={">0<2"}
>}[CaseNo])
/
Count({$<
[Date.autoCalendar.MonthsAgo]={">0<2"}
>}[CaseNo]))

I then create a CONDITION in Nprinting saying that if VARIABLE is LESS THAN CONSTANT. Setting this CONDITION on reports as TRUE for publishing.

I have tried the following CONSTANT values:
0,98 - Lets everything thru
0.98 - Stops everything (wrong format I am guessing)
98% - Lets everything thru

Do I need to put a ='0,98' or something else in the CONSTANT? Or is there something else faulty with this?

Labels (2)
1 Solution

Accepted Solutions
Lech_Miszkiewicz

Hi, you tried that already as well but I still will touch on that topic...

I see that you are writing comma (,) as decimal point. It is possible that in Qlik Sense and in NPrinting you are using dot (.) as decimal point. That would mean that you are comparing number to text since they could be different values because of character used. 

I often suggest to multiply your expression variable by 100 so then you dont need to use any characters which could cause issue. If I was writing your expression i would do following:

=Floor(100*(1-(Count({$<
Error={'Value'},
[Date.autoCalendar.MonthsAgo]={">0<2"}
>}[CaseNo])
/
Count({$<
[Date.autoCalendar.MonthsAgo]={">0<2"}
>}[CaseNo]))))

Then in NPrinting you can just compare it to integer values like 95 or 98 or whatever....

Have you tried that?

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
Lech_Miszkiewicz

Does your variable expand? Do you have = sign in front of your expression in variable definition?

this is explained here:

https://help.qlik.com/en-US/nprinting/May2021/Content/NPrinting/Troubleshooting/Variables-dont-expan...

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.
sebastianhansso
Contributor
Contributor
Author

Hi Lech,

I did NOT have a "=" in front of the variable, so that might have been an issue. Now rectified thank you.

I still get the issue that even though I set the CONSTANT to 0,98 my two test reports, both get through the CONDITION although both request it to be TRUE that VARIABLE is LESS THAN 0,98.

REPORT                                       VARIABLE VALUE
-------------------------------------------------------------
report1                                        0,98189354275742
report2                                        0,95216049382716

Lech_Miszkiewicz

Hi, you tried that already as well but I still will touch on that topic...

I see that you are writing comma (,) as decimal point. It is possible that in Qlik Sense and in NPrinting you are using dot (.) as decimal point. That would mean that you are comparing number to text since they could be different values because of character used. 

I often suggest to multiply your expression variable by 100 so then you dont need to use any characters which could cause issue. If I was writing your expression i would do following:

=Floor(100*(1-(Count({$<
Error={'Value'},
[Date.autoCalendar.MonthsAgo]={">0<2"}
>}[CaseNo])
/
Count({$<
[Date.autoCalendar.MonthsAgo]={">0<2"}
>}[CaseNo]))))

Then in NPrinting you can just compare it to integer values like 95 or 98 or whatever....

Have you tried that?

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.
sebastianhansso
Contributor
Contributor
Author

Thank you Lech,

Seems like (,) or (.) are both no good ideas when handling variables in conditions. But using none decimal values seems to do the trick.

 

Brgds

Sebastian