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: 
Not applicable

Solution for Multiple IF Statement


Hi ALL

Is There AnyShortCut Method in the qlikview instead of using multiple if statement(Like Below) in the script...

IF(LEN(VERTICAL_DESC_V)<1,

(
    IF(WILDMATCH(VERTICAL_DESC,'*CBG*')>0,'CBG',
       IF(WILDMATCH(VERTICAL_DESC,'RURAL AND AGRI BUSINESS GROUP')>0,'RURAL AND AGRI BUSINESS GROUP',
          IF(WILDMATCH(SUB_VERTICAL_DESC,'RETAIL DIRECT')>0,'DIRECT (D1)',
            IF(WILDMATCH(SUB_VERTICAL_DESC,'AUTO')>0,'AUTO DISTRIBUTION',
              IF(WILDMATCH(SUB_VERTICAL_DESC,'BANCA (B4)')>0,'BANCASSURANCE (B4)',
                IF(WILDMATCH(SUB_VERTICAL_DESC,'TRACTOR')>0,'RETAIL TRACTOR',
                 IF(WILDMATCH(SUB_VERTICAL_DESC,'BANCA (B1)')>0,'BANCASSURANCE (B1)',
                   IF(WILDMATCH(SUB_VERTICAL_DESC,'DIRECT HEALTH GROUP')>0,'DIRECT HEALTH (D3)',
                     IF(WILDMATCH(SUB_VERTICAL_DESC,'BANCA (B3)')>0,'BANCASSURANCE (B3)',
                      IF(WILDMATCH(SUB_VERTICAL_DESC,'DIRECT AGENT GROUP')>0,'ONLINE SALES (D2)',
                       IF(WILDMATCH(SUB_VERTICAL_DESC,'AGENCY 2')>0,'AGENCY 2',
                      
                        IF(WILDMATCH(SUB_VERTICAL_DESC,'BANCA (B2)')>0,'BANCASSURANCE (B2)',
                        IF(WILDMATCH(SUB_VERTICAL_DESC,'AGENCY 1')>0,'AGENCY 1',SUB_VERTICAL_DESC
                          )
                          )
                         )
                        )
                       )
                     )
                    )
                   )
                 )
               )
             )
           )
         )
)
,
VERTICAL_DESC_V  ) AS VERTICAL_DESC_TEST

RESIDENT Inward_details;

Regards

Sarfaraz

3 Replies
crusader_
Partner - Specialist
Partner - Specialist

Hi,

As soon as you're checking the value of one filed you can use here ApplyMap() function and mapping load or Alt() function

Hope this helps

Andrei

ashfaq_haseeb
Champion III
Champion III

Or can have a separate mapping inline  table

Regards

ASHFAQ

AbhijitBansode
Specialist
Specialist


can use Pick function along with Wildmatch like below:

If(LEN(VERTICAL_DESC_V)<1,
Pick
(
      Wildmatch(VERTICAL_DESC,'*CBG*','RURAL AND AGRI BUSINESS GROUP'),
      'CBG',
      'RURAL AND AGRI BUSINESS GROUP'
),
VERTICAL_DESC_V
) as VERTICAL_DESC_TEST;

and so on...