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

Announcements
Save $650 on Qlik Connect, Dec 1 - 7, our lowest price of the year. Register with code CYBERWEEK: Register
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

If and Multiple AND's


Hi,

      I have 10 fileds with blank  and if all are blank then pass else fail.

I wrote an expression like this in straight table which is not showing  any result:

if(if(STR_SUPPL1=' 'and STR_SUPPL2=' 'and STR_SUPPL3=' ' and PO_BOX_LOC='' and PO_BOX_NUM='' and
    PO_BOX_REG=''and PO_BOX_CTY='' and ROOMNUMBER='' and FLOOR='','PASS'),'FAIL')

And  tried same with isnull().

anybody pls help me.

Thanks

1 Solution

Accepted Solutions
petter
Partner - Champion III
Partner - Champion III

If(

(STR_SUPL1 & STR_SUPPL2 & STR_SUPPL3 & PO_BOX_LOC & PO_BOX_NUM & PO_BOX_REG & PO_BOX_CITY & ROOMNUMBER & FLOOR) = ''

, 'PASS' , 'FAIL'

)

View solution in original post

10 Replies
petter
Partner - Champion III
Partner - Champion III

If(

(STR_SUPL1 & STR_SUPPL2 & STR_SUPPL3 & PO_BOX_LOC & PO_BOX_NUM & PO_BOX_REG & PO_BOX_CITY & ROOMNUMBER & FLOOR) = ''

, 'PASS' , 'FAIL'

)

sunny_talwar

Try with Len(Trim()) may be:

Len(Trim(FieldName)) = 0

petter
Partner - Champion III
Partner - Champion III

Remember that writing an expression in a chart you should (almost always) use an aggregation function. The only exception to the rule is that if you are 100% certain that your dimension will pick one single row for each expression and only one...

sunny_talwar

Stealing Petter‌ idea and using it with Len(Trim())


If(Len(Trim(STR_SUPL1 & STR_SUPPL2 & STR_SUPPL3 & PO_BOX_LOC & PO_BOX_NUM & PO_BOX_REG & PO_BOX_CITY & ROOMNUMBER & FLOOR)) = 0, 'PASS', 'FAIL')

Qrishna
Master
Master

where did you write the expression? in script or front end? (please specify whenever you use some functions which  are common for scripting and UI).

try :

=if( isnull(STR_SUPPL1) and isnull(STR_SUPPL2) and blah blah , 'PASS','FAIL')

maxgro
MVP
MVP

why 2 if?

remove one if and remove )

also you have some check with a space ' ' and some check without ''

if(STR_SUPPL1=' 'and STR_SUPPL2=' 'and STR_SUPPL3=' ' and PO_BOX_LOC='' and PO_BOX_NUM='' and
    PO_BOX_REG=''and PO_BOX_CTY='' and ROOMNUMBER='' and FLOOR='','PASS','FAIL')

another thing

if your field are nulls or blanks you can use

if(len(trim(field))=0 and ....

handry_orozco
Partner - Contributor III
Partner - Contributor III

Hi

If (Isnull(Field1 and Field2 and Field...) = True(), Fail)

prabhu0505
Specialist
Specialist

attach the file

Not applicable
Author

petter it worked

Thank u