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

Announcements
Join us in Bucharest on Sept 18th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
vanir88
Creator
Creator

How to extract country column

Hi,

i have a requirement like 

if [contract type] =MNon agreement then [country] should be [Contract country] column else [contract name] column

here (contract country, contract name, contract type ) are existing columns

country column is new column it has to create based on below condition.

eg: in below table  [Contract type] = "MNonAgreement" then [country] should take as 'ind', for rest country column shuld take from Contract name column

 

country contracting country contract name contract type
  ind   Nonagreement
    us ICclosureAgreement
    uk ICclosureAgreement
    ind ICclosureAgreement
  ind   MNonAgreement
  Germany   MNonAgreement
  ind   MNonAgreement
  ind   MNonAgreement
Labels (2)
1 Solution

Accepted Solutions
MayilVahanan

Hi

@durgesh22 provided the end result with your sample data. However, you can implement the logic in your original script

Logic:                    

if(contract_type = 'MNonAgreement',contracting_country,contract_name) as Country

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.

View solution in original post

4 Replies
durgesh22
Creator
Creator

Hi ,

Please refer below.

 

tab1:
load * inline [
contracting_country,contract_name,contract_type
ind,'',Nonagreement
'',us,ICclosureAgreement
'',uk,ICclosureAgreement
'',ind,ICclosureAgreement
ind,'',MNonAgreement
Germany,'',MNonAgreement
ind,'',MNonAgreement
ind,'',MNonAgreement
];
NoConcatenate
tab2:
load *,if(wildMatch(contract_type,'MNonAgreement'),contracting_country,contract_name) as Country Resident tab1;
drop table tab1;

durgesh22_0-1676890282109.png

 

 

vanir88
Creator
Creator
Author

no, if we have 5 or 10 columns then we can give manally but we have 1000s.... records so we cont add manually right

vanir88
Creator
Creator
Author

can anyone help on this please

MayilVahanan

Hi

@durgesh22 provided the end result with your sample data. However, you can implement the logic in your original script

Logic:                    

if(contract_type = 'MNonAgreement',contracting_country,contract_name) as Country

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.