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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Overwriting values of an attribute in Load script

Hi

I have two tables:

1. sec_master and

2. security_classification

They are combined using outer join and using security_id (key)

Now, to the resulting table sec_master, I need to specify that;

If instrument_type is CRNY, CD, or VRDN

then industry_lvel1_desc = CASH

else  industry_lvel1_desc = industry_lvel1_desc

For some reason I am getting an error. Following is the script and error log.

sec_master:
LOAD security_id,
instrument_type
FROM
(
qvd);

OUTER join LOAD
 
security_id,
industry_level1_desc as MSCI_industry_level1_desc
FROM
(
qvd);

NOCONCATENATE LOAD *,
If(Match(instrument_type,'CRNY','CD','INVTFRE','INVTFRET','INVTXRE','INVTXRET','STIF','TECP','VRDN'),'CASH', industry_level1_desc)
RESIDENT sec_master;
DROP TABLE sec_master;

Error Message:

Any suggestion how to fix this?

Thanks

2 Replies
Anonymous
Not applicable
Author

Looks like industry_level1_desc was renamed to MSCI_industry_level1_desc earlier :

    
OUTER join LOAD
 
security_id,
industry_level1_desc as MSCI_industry_level1_desc
FROM
(
qvd);

Not applicable
Author

Hi Bill

Good point. After applying following change the syntax error is eliminated, However the logic is still not implemented the way it is intended.

sec_master:
LOAD security_id,
instrument_type
FROM
(
qvd);

UTER join LOAD
security_id,
industry_level1_desc as MSCI_industry_level1_desc
FROM
(
qvd) ;


NOCONCATENATE LOAD *,
If(Match(instrument_type,'CRNY','CD','INVTFRE','INVTFRET','INVTXRE','INVTXRET','STIF','TECP','VRDN'), 'CASH', MSCI_industry_level1_desc) as MSCI_industry_level1_desc_L1

RESIDENT sec_master;
DROP TABLE sec_master;

The code is working if I create a separate attribute and call it for example MSCI_industry_level1_desc_L1.

The intended out put is to overwriting the attribute MSCI_industry_level1_desc which is not working.

for example, it doesn't work if I use the line

if(Match(instrument_type,'CRNY','CD','INVTFRE','INVTFRET','INVTXRE','INVTXRET','STIF','TECP','VRDN'), 'CASH', MSCI_industry_level1_desc)

INSTEAD OF THE LINE

If(Match(instrument_type,'CRNY','CD','INVTFRE','INVTFRET','INVTXRE','INVTXRET','STIF','TECP','VRDN'), 'CASH', MSCI_industry_level1_desc) as MSCI_industry_level1_desc_L1

How to overwrite the attribute MSCI_industry_level1_desc?