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

Announcements
Join us in Toronto Sept 9th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Problem with nested if-statements

I have the following expression:

if(FVCON_ID_CONTAT=5,

    if(date#(trim(right((FVCON_DATA_FI),2) & '/' & mid((FVCON_DATA_FI),5,2) & '/' & Left((FVCON_DATA_FI),4)),'YYYYMMDD') =

        (date#(trim(right(Date(FVCON_TS_ESTR,'YYYYMMDD'),2) & '/' & mid(Date(FVCON_TS_ESTR,'YYYYMMDD'),5,2) & '/' & Left(Date(FVCON_TS_ESTR,'YYYYMMDD'),4)),'YYYYMMDD')

                    or

                (FVCON_DATA_FI=0)),'aperte','chiuse')) as SelettorePraticheAperteChiuse,

The problem is that the value of SelettorePraticheAperteChiuse is only chiuse but I would that have the value aperte and chiuse.


Where is the problem ?

Thanks, Giovanni

12 Replies
Not applicable
Author

Hi Helen, it don't works ...missing a parenthesis and I don't know where ...

Not applicable
Author

Hi Giovanni

I have double checked and there is no missing parenthesis, I presumed this was part of a load script, was I correct?

Helen

Not applicable
Author

Hi Helen, in your script I removed the condition


=FVCON_DATA_FI=0) ....

The expression is:


if(FVCON_ID_CONTAT=5,

   if((date#(trim(right((FVCON_DATA_FI),2) & '/' & mid((FVCON_DATA_FI),5,2) & '/' & Left((FVCON_DATA_FI),4)),'YYYYMMDD')

   =date#(trim(right(Date(FVCON_TS_ESTR,'YYYYMMDD'),2) & '/' & mid(Date(FVCON_TS_ESTR,'YYYYMMDD'),5,2) & '/' & Left(Date(FVCON_TS_ESTR,'YYYYMMDD'),4)),'YYYYMMDD')

   or

   date#(trim(right((FVCON_DATA_FI),2) & '/' & mid((FVCON_DATA_FI),5,2) & '/' & Left((FVCON_DATA_FI),4)),'YYYYMMDD')

   =FVCON_DATA_FI),'aperte','chiuse'),'chiuse')   as SelettorePraticheAperteChiuse,

And I have no problem, it works ok but I have another problem.

If I use this field I have the value aperte and chiuse for the same ID, only for some ID, not for ALL.


Why ?

Thanks a lot Helen, if you have some suggest please tell me ...