HOW TO IMPLEMENT ‘ QLIK VIEW APPLY MAP FUNCTIONALITY’ IN HANA GRAPHICAL VIEWS
ApplyMap is a lookup or mapping function in QlikView. This function takes one value as input and checks if that value exists in a mapping table and returns the corresponding values from the second column of the mapping table, if the value doesn’t exists it out puts the ‘Default value’.
Syntax of Applymap in QlikView:
Applymap (‘Mapping Table Name’,Mapping_Column,’Default value’).
In QlikView it is mandatory that the mapping table should have only two columns.
In HANA Graphical views we can implement this functionality by using ‘Outer Join’.
For this example we will take two tables Sales table (TBL_SALES) & ‘Customer table’ (MAP_TBL_CUSTOMER this will be our mapping table). In ‘MAP_TBL_CUSTOMER’ table all the information about the customer is stored, for this example we will take CUSTOMER_ID and CUSTOMER_NAME. In ‘TBL_SALES’ table we are having all the sales related details except in CUSTOMER_NAME column we don’t have data. Now we will see how to fill the CUSTOMER_NAME column in sales table based on CUSTOMER_ID using customer table as mapping table.
Note here customer name column wont have any data.
Create a Graphical view (for this example Attribute view)and add both the sales and customer tables (TBL_SALES & MAP_TABL_CUSTOMER) to the Data Foundation.
Now create a join between ‘TBL_SALES’ & MAP_TABL_CUSTOMER’ using CUSTOMER_ID attribute ,with Join type as ‘Left Outer ‘ .
Then select the CUSTOMER_NAME field from the Right table ‘MAP_TBL_CUSTOMER’.
Validate & Activate the view , do a data preview and you will find CUSTOMER_NAME column filed with data.
If you want to replace the null values with some ‘default values’ then simply create a Calculated column using the if condition as shown below.
That’s it enjoy!.