Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
sculptorlv
Creator III
Creator III

Inhered data

Hello, I hope you can help me with new info.

I have the following table:

Description Value Reserve

Canada      10

Sweden     15

Chine          7

Japan          -          Poland

Poland      8

Finland     3             Norwey

Norwey     5

I need to remake this table in order to add extra value from reserved countries:

Description Value

Canada      10

Sweden     15

Chine          7

Japan          8

Poland      8

Finland     8            

Norwey     5

How can I do this transformation?

Thank you in advance!

5 Replies
jmmolero
Partner - Creator
Partner - Creator

Hi Ruslans,

Create a mapping table:

[map_table]:

LOAD distinct Reserve,

Value

FROM YourTable...;

[YourTable]:

LOAD

Description

Applymap('map_table',Description, Value) as Value

FROM YourTable...;

sculptorlv
Creator III
Creator III
Author

Can you please hel with a correct syntax?

Doesn't work right now.

'MAP_TABLE':

LOAD distinct

Alternative_Contract_Number,

Contract_Delivery_Times

RESIDENT  CONTRACT_AND_DELIVERIES;

FINAL_DATA:

LOAD

Contract_Number,

Contract_Name,

Customer_Number,

Manager_Name,

Customer_Type,

Contract_Start_Date,

Contract_Devices_Quantity,

Alternative_Contract_Number,

Contract_Delivery_Times,

Applymap('MAP_TABLE',Contract_Number, Contract_Delivery_Times) AS Contract_Delivery_Times_Alternative

RESIDENT CONTRACT_AND_DELIVERIES;

DROP TABLE CONTRACT_AND_DELIVERIES;

DROP TABLE 'MAP_TABLE';

Wrong.jpg

agigliotti
Partner - Champion
Partner - Champion

try with below script:

MAP_TABLE:

Mapping

LOAD distinct

Alternative_Contract_Number,

Contract_Delivery_Times

RESIDENT  CONTRACT_AND_DELIVERIES;

FINAL_DATA:

LOAD

Contract_Number,

Contract_Name,

Customer_Number,

Manager_Name,

Customer_Type,

Contract_Start_Date,

Contract_Devices_Quantity,

Alternative_Contract_Number,

Contract_Delivery_Times,

ApplyMap('MAP_TABLE', Contract_Number, 'N/A') AS Contract_Delivery_Times_Alternative

RESIDENT CONTRACT_AND_DELIVERIES;

DROP TABLE CONTRACT_AND_DELIVERIES;

sculptorlv
Creator III
Creator III
Author

Now, changes are made for ALL rows, not only for Contracts will atlernative values

Wrong.jpg

jmmolero
Partner - Creator
Partner - Creator

Hi Ruslans

You can get more information about "mapping" here https://help.qlik.com/es-ES/qlikview/12.1/Subsystems/Client/Content/Scripting/ScriptPrefixes/Mapping...

Try this:

'MAP_TABLE':

Mapping LOAD distinct

Contract_Number,

Contract_Delivery_Times

RESIDENT  CONTRACT_AND_DELIVERIES;

FINAL_DATA:

LOAD

Contract_Number,

Contract_Name,

Customer_Number,

Manager_Name,

Customer_Type,

Contract_Start_Date,

Contract_Devices_Quantity,

Alternative_Contract_Number,

Contract_Delivery_Times,

Applymap('MAP_TABLE',Alternative_Contract_Number, Contract_Delivery_Times) AS Contract_Delivery_Times_Alternative

RESIDENT CONTRACT_AND_DELIVERIES;

DROP TABLE CONTRACT_AND_DELIVERIES;