Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

[resolved] Activate Expression filter multiple clause

Hi,
I have two requirements where I have to reject rows. The first one is working great but I do not know how to add the second requirement. The two requirements are totally variant from each other and need to be dealt separately. My second requirement is to throw out the Reid, John and Cindy with the date 3/8/2015 into the tpostgresqloutput_2 like I am doing with the unknown values from the Builder column. I want to know if I can apply two if statements in the same expression filter affecting totally different rows. I have added a comma after the first requirement to show that the two requirements are two different if clauses.
    !"unknown".equals(row1.Builder) ,
    !"Reid, John & Cindy".equals(row1.Last_Name_First_Name) && row1.Actual_Sale_Date=="3/8/2015"
0683p000009MCeu.png
Labels (2)
1 Solution

Accepted Solutions
Anonymous
Not applicable
Author

Thanks Sabrina,
Should I also name the second set of tpostgreSQLoutputs the same as the first set?

Sorry, I don't understand your question. BTW, I am Shong, not Sabrina. 0683p000009MA9p.png
this line threw out an error:
string and date operand error.

What's data type of Actual_Sale_Date column?
If String, the expression should be:
(!"Reid,John & Cindy".equals(row1.Last_Name_First_Name)) && row1.Actual_Sale_Date.equals("03/08/2015")
If Date:
(!"Reid,John & Cindy".equals(row1.Last_Name_First_Name)) && TalendDate.formatDate("dd/MM/yyyy", row1.Actual_Sale_Date ).equals("03/08/2015")

Regards
Shong

View solution in original post

6 Replies
Anonymous
Not applicable
Author

Hi 
It is impossible to add different filter conditions in the same field. As a workaround, duplicate the input data and do the filter two times, eg:
...tfileinputDelimited--main..tReplicated--main--tMap1(do filter1)--
                                                         --main--tMap2(do filter2)--
Regards
Shong
Anonymous
Not applicable
Author

I do not understand Sabrina, do you I need to add two more tPostgresqloutput since I have to add one more tMap? Please provide me with an image which can guide me. I need to add two filters overall.
Anonymous
Not applicable
Author

Yes, you need to add different tPostgresqlOutput components for each filter operation.
...tfileinputDelimited--main..tReplicated--main--tMap1(do filter1)--out1--tPostgresqloutput1
                                                                                          --reject1--tPostgresqloutput2
                                                       --main--tMap2(do filter2)--out2--tPostgresqloutput3
                                                                                           --reject2--tPostgresqloutput4
Anonymous
Not applicable
Author

Thanks Sabrina,
Should I also name the second set of tpostgreSQLoutputs the same as the first set?
e.g.
treplicate-------->tmap1------>tpostgreSQLoutput (mytable)
                         tmap1------>tpostgreSQLoutput (rejectedtable)
----------------------tmap2-------->tpostgreSQLoutput(mytable)
                           tmap2-------->tpostgreSQLoutput (rejectedtable)
My second filter is 
!'Reid,John & Cindy'.equals(row1.Last_Name_First_Name) && row1.Actual_Sale_Date == '03/08/2015'
this line threw out an error:
string and date operand error.
Anonymous
Not applicable
Author

Thanks Sabrina,
Should I also name the second set of tpostgreSQLoutputs the same as the first set?

Sorry, I don't understand your question. BTW, I am Shong, not Sabrina. 0683p000009MA9p.png
this line threw out an error:
string and date operand error.

What's data type of Actual_Sale_Date column?
If String, the expression should be:
(!"Reid,John & Cindy".equals(row1.Last_Name_First_Name)) && row1.Actual_Sale_Date.equals("03/08/2015")
If Date:
(!"Reid,John & Cindy".equals(row1.Last_Name_First_Name)) && TalendDate.formatDate("dd/MM/yyyy", row1.Actual_Sale_Date ).equals("03/08/2015")

Regards
Shong
Anonymous
Not applicable
Author

Thanks Shong not Sabrina!!!!