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: 
curiousfellow
Specialist
Specialist

Nprinting 17 ignoring selected values in qvw ?

In Nprinting I created a report from a qvw that uses variables in expressions.(set analysis)

In Nprinting 17 I cannot find any possibilities to use this variable in a filter.

It looks like Nprinting 17 does not use the selected listbox values so the variable does not gets the right value.

Is there another way to get a value to this variable ?

1 Solution

Accepted Solutions
Lech_Miszkiewicz
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi - My comments in RED (sorry - bit messy)

In my listbox there is an expression :

=if(Period_num > 0 ,if(Period_num < 13,Period_num))

(why dont you create in you datamodel "new field" which already has this condition calculated (so it will only contain values and records linked to values from 1-12)? and then apply NPrinting filter on it using simple =max("newfield"))

Then I have a variable selected_period : max(period)

(is it max(period) ??? where is period coming from? is it another field?

or it is max(Period_num)?


i would suggest to use following: selected_period : =max(newfield) - notice"=" sign before my variable, which evaluates variable on each "click"

In my qvw I have two expressions using selected_period :

Sum({$<Period_num = {"<= $(selected_period)"}>}[amount])

and

Sum( if(Period_num = $(selected_period),[amount],0))

(this will then work without issues)

The qvw works fine, and I would not like to have to rebuild it ofr Nprinting.

I think the problem is that in Nprinting the variable selected_period does not get a value ?

like i said

  • simplify it!
  • create new field calcualted in datamodel  if(Period_num > 0 ,if(Period_num < 13,Period_num)) as newfield
  • change your variable to be selected_period : =max(newfield)

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.

View solution in original post

7 Replies
Lech_Miszkiewicz
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi,

what is in your listbox text? number or dual value (text & number - for example month (Jan for text or 1 for number)

make sure you use filters according to their types: see this for detailed information (slightly differnet topic but i guess your problem is datatype when trying to apply filter):

https://community.qlik.com/message/1268669?et=watches.email.thread#1268669

also make sure your variable expression starts with "=" sign so it can get evaluate on each selection.

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.
curiousfellow
Specialist
Specialist
Author

In my listbox there is an expression :

=if(Period_num > 0 ,if(Period_num < 13,Period_num))

Then I have a variable selected_period : max(period)

In my qvw I have two expressions using selected_period :

Sum({$<Period_num = {"<= $(selected_period)"}>}[amount]

and

Sum( if(Period_num = $(selected_period),[amount],0))

The qvw works fine, and I would not like to have to rebuild it ofr Nprinting.

I think the problem is that in Nprinting the variable selected_period does not get a value ?

Lech_Miszkiewicz
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi - My comments in RED (sorry - bit messy)

In my listbox there is an expression :

=if(Period_num > 0 ,if(Period_num < 13,Period_num))

(why dont you create in you datamodel "new field" which already has this condition calculated (so it will only contain values and records linked to values from 1-12)? and then apply NPrinting filter on it using simple =max("newfield"))

Then I have a variable selected_period : max(period)

(is it max(period) ??? where is period coming from? is it another field?

or it is max(Period_num)?


i would suggest to use following: selected_period : =max(newfield) - notice"=" sign before my variable, which evaluates variable on each "click"

In my qvw I have two expressions using selected_period :

Sum({$<Period_num = {"<= $(selected_period)"}>}[amount])

and

Sum( if(Period_num = $(selected_period),[amount],0))

(this will then work without issues)

The qvw works fine, and I would not like to have to rebuild it ofr Nprinting.

I think the problem is that in Nprinting the variable selected_period does not get a value ?

like i said

  • simplify it!
  • create new field calcualted in datamodel  if(Period_num > 0 ,if(Period_num < 13,Period_num)) as newfield
  • change your variable to be selected_period : =max(newfield)

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.
curiousfellow
Specialist
Specialist
Author

You are absolutely right. However, this is one of the first app I made, and I would do it on a different way nowadays.

But the qvw works fine, and I don't like to have to rebuild it just for Nprinting.

Lech_Miszkiewicz
Partner Ambassador/MVP
Partner Ambassador/MVP

Well,

maybe someone else will have an idea how to provide a solution you need. I am running out of options

In my opinion required change does not have any effect on what you have build so far, and it is just an additional field really. which removes expression from your listbox and is used in variable which you have anyway.

Variable will then work inside expression used in your charts, and it will work in NPrintign too.

my opinion is: to always improve whatever  can be improved,

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.
curiousfellow
Specialist
Specialist
Author

I followed your suggestion. And now it works like it should.

Thnx

Lech_Miszkiewicz
Partner Ambassador/MVP
Partner Ambassador/MVP

good on you!

cheers

LM

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.