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: 
nevilledhamsiri
Specialist
Specialist

Can the wildmatch/ pick match or if statement be used over data loaded via load inline feature?

As per the loaded data, I need 1st three codes (MC, M4,M3) to be renamed as MO & other codes as NM. How this is done using said functions

Thanks

Neville

1 Solution

Accepted Solutions
vishsaggi
Champion III
Champion III

You did not close the bracket for IF try below:

LOAD *,IF(MATCH(ACCOUNT_CODE,'61250','61150','61350'), 'MO',IF(MATCH(ACCOUNT_CODE,'61110','61210','61160','61230','61150'),'NM')) AS NEW_CODE INLINE [

View solution in original post

5 Replies
nevilledhamsiri
Specialist
Specialist
Author

attached doc

vishsaggi
Champion III
Champion III

Try this:

LOAD *, IF(Match(PRD_CODE, 'MC','M3','M4'), 'MO','NM') AS NewCode INLINE [

    PRD_CODE, ACCOUNT_CODE,VALUE

    MC, 61250,50000

    M3, 61150,25000

    M4, 61350,15000

    FR, 61110,12000

    TC, 61210,10000

    MS, 61160,4500

    HH, 61230,5000

    PP, 61150,50000

];

nevilledhamsiri
Specialist
Specialist
Author

Hi Vishwarath,

Thanks for the reply. this is ok, If I have more codes for other variables which I have  included here (KK,UU) when I need to specificaly mention that code 61250,61150,61350 to be named as MO & need to mention the other codes as NM which I wrote here has a syntax error.Can you please advice me on this. because if I  merely say these three codes as MO & all other codes as NM ,all balance codes including KK & UU too will be named as NM. I need not KK & UU to be named NM.


LOAD *,IF(MATCH(ACCOUNT_CODE,'61250','61150','61350'), 'MO',IF(MATCH(ACCOUNT_CODE,'61110','61210','61160','61230','61150'),'NM') AS NEW_CODE INLINE [

    PRD_CODE, ACCOUNT_CODE,VALUE

    MC, 61250,50000

    M3, 61150,25000

    M4, 61350,15000

    FR, 61110,12000

    TC, 61210,10000

    MS, 61160,4500

    HH, 61230,5000

    PP, 61150,50000

    KK,51111,2000

    UU,51112,3000

];

vishsaggi
Champion III
Champion III

You did not close the bracket for IF try below:

LOAD *,IF(MATCH(ACCOUNT_CODE,'61250','61150','61350'), 'MO',IF(MATCH(ACCOUNT_CODE,'61110','61210','61160','61230','61150'),'NM')) AS NEW_CODE INLINE [

nevilledhamsiri
Specialist
Specialist
Author

Thanks Viswarath

It is pretty alright!

Neville