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: 
ali_hijazi
Partner - Master II
Partner - Master II

Apply OR between fields of a filter

Hello
I got a task in NPrinting and this task has a filter 
what I want to accomplish in the filter is that Field1 = value1 or Field2 = value2

and I may want to add a third field Field3 <> value3
kindly advise on how to accomplish this

I can walk on water when it freezes
Labels (2)
2 Replies
Frank_S
Support
Support

Since you indicate 'may' add a third filter, this suggest creating a condition.

To create a conditional, please follow:

If you wish to add a third filter, you can use the steps below but you should 'test' the syntax in qlik sense 'before' using the filter syntax in your NPrinting filter.

Kind regards...

Please remember hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!
Lech_Miszkiewicz
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi,

Filters in NPrinting are equivalent of selections in Qlik Sense. By default selections are behaving as an "AND" mode and not "OR" in Qlik Sense so there is no such a thing like "OR" behaviour without applying a workaround.

 

The workaround is that you are applying a filter on another single field which contains unique granularity to allow for all your OR conditions to be applied. Such field can be for example key which you have to create in your datamodel and which will include all fields you want to use in your "OR" filter.

Here is my example:

  • I have data model with 3 dimensions and 1 measure 
    • Dim1
    • Dim2
    • Dim3
    • Sum(Expression1)
  • in My data model I am creating TransId field by concatenating fields from all dimensions required
    • (Dim1&'|'&Dim2&'|'&Dim3) as TransId,
  • With TransId field created I can now apply advanced search filter on it to allow for "OR" filter
    • TransId =sum({<Dim1={A}>+<Dim2={c}>}Expression1)>0
    • If you would like to filter on 3 fields you could also do that by adding extra field to set analysis just like below:
      • TransId =sum({<Dim1={A}>+<Dim2={c}>+<Dim3={X}>}Expression1)>0

Below are screenshots of my testing directly in Qlik Sense and then filter applied in NPrinting. In the final report I would not use the last colum which was only shown in my table to test if advanced filter will return the records I need.

Sample App and testing SetAnalysis syntax in Qlik Sense objectSample App and testing SetAnalysis syntax in Qlik Sense object

 

 

 

 

 

 

 

 

 

 

 

 

testing set analysis "Or" filtering

Lech_Miszkiewicz_2-1631680842950.png

Applying Advanced search in NPrinting. This filter will filter all records where Dim1=A or Dim2=c.

 

So depending on your scenario you may go ahead and try Franks suggestion. His scenario though describes different use case. Conditions will be usefull for the scenarios where you would like to pick whether you will use 2 or 3 filters dynamicly. Those filters would still work like regular selections in Qlik Sense (Filter1 and Filter2 resulting in intersection being returned).

However if your intend is to filter report by returning records which meet filter 1 criteria or filter 2 criteria then you need to follow my approach.

 

For reference I am attaching the Qlik Sense app

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.