Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
jmarinesc
Contributor III
Contributor III

Expr ´OK´ But not works for me...

Hello !

I am using:

Count ({<Field1={'-2'},Field2-={'-1'},Field3-={´-1´},Field4-={'-1'}>}Fieldn) 

Expr is ´OK´ but I don´t get my result, I get (0) and It must be (5) in One Field

Attached My Ex1.qvw

Tk a Lot in advanced.

1 Solution

Accepted Solutions
Gysbert_Wassenaar

No, I need to count Fieldn only (if : Field4 ={'-2'} and Field1, Field2, Field3 not equal to {'-1'} or equal to {'-'})


The count of that is 0. There are no records where Field1 has another value than -1 or null. Same for Field2 and Field3.

If you want the count of items where Field4= -2 and Field1,Field2 and Field3 are null, try this:

COUNT({<Field4={'-2'}>-<Field1={'*'}>-<Field2={'*'}>-<Field3={'*'}>} Fieldn)

Inline load cannot produce nulls. Your inline load creates strings '-' instead of nulls. That's why your expression does work with the inline load.


talk is cheap, supply exceeds demand

View solution in original post

5 Replies
Gysbert_Wassenaar

Is this what you're looking for?

COUNT ({<Field1={'-1'} ,Field2={'-1'} ,Field3={'-1'} ,Field4={'-2'}>}Fieldn)


talk is cheap, supply exceeds demand
jmarinesc
Contributor III
Contributor III
Author

Hello;

No, I need to count Fieldn only (if : Field4 ={'-2'} and Field1, Field2, Field3 not equal to {'-1'} or equal to {'-'})

Regards

JMC

jmarinesc
Contributor III
Contributor III
Author

Hello! QViewComm

If I try With INLINE data: It works, but not with (Load QVD or Load Xlsx) Attached Ex2.qvw

Expr:        COUNT ({<Field1-={'-1'} ,Field2-={'-1'} ,Field3-={'-1'} ,Field4={'-2'}>}Fieldn)

LOAD * INLINE [

   Fieldn, Field1, Field2, Field3, Field4

   1789,-,-1,-1,-2

   1790,-,-1,-1,-2

   1791,-,-1,-1,-2

   201006021,-,-1,-1,-2

   201006021,-,-1,-1, -2

   1790,-,-,-1,-2

   201006011,-,-,-,-1,-2

   201006011,-,-,-,-1,-2

   201006023,-,-,-,-1,-2

   201006023,-,-,-,-1,-2

   1789,-,-1,-1,-2

   1592380.1,-,-, -1,-2

   1592381.1,-,-,-1,-2

   1592382.1,-,-,-1,-2

   1592383.1,-,-,-1,-2

   1521600,-,-,-,-2

   1521601,-,-,-,-2

   1521602,-,-,-,-2

   1521722,-,-,-,-2

   1521723,-,-,-,-2

   20720003,-,-,-1,-  

   20720004,-,-,-1,-  

   20720005,-,-,-1,- 

   20720006,-,-,-1,-  

   20720007,-,-,-1,-  

   20882087,-,-,-1,-  

   20882088,-,-,-1,-  

   20882089,-,-,-1,- 

   20882090,-,-,-1,-  

   20882091,-,-,-1,-  

   1047610946,-1,-1,-1,-2

   1047610950,-1,-1,-1,-2

   LTO1006102ET001,-1,-1,-1,-2

   MEX1006101ED001,-1,-1,-1,-2

   TIJ1006102ET001,-1,-1,-1,-2

];

But with:

Test:

LOAD *

FROM

(ooxml, embedded labels); 

It Doesn´t work.

Tk Tk Tk

Gysbert_Wassenaar

No, I need to count Fieldn only (if : Field4 ={'-2'} and Field1, Field2, Field3 not equal to {'-1'} or equal to {'-'})


The count of that is 0. There are no records where Field1 has another value than -1 or null. Same for Field2 and Field3.

If you want the count of items where Field4= -2 and Field1,Field2 and Field3 are null, try this:

COUNT({<Field4={'-2'}>-<Field1={'*'}>-<Field2={'*'}>-<Field3={'*'}>} Fieldn)

Inline load cannot produce nulls. Your inline load creates strings '-' instead of nulls. That's why your expression does work with the inline load.


talk is cheap, supply exceeds demand
jmarinesc
Contributor III
Contributor III
Author

Gysbert!!!

It works!      Thanks a lot!   I appreciate it!

JMC