Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
magnusrydberg
Partner - Contributor II
Partner - Contributor II

Using Map-function (Applymap) in a sql statement

Hi,

I'm trying to use "Applymap" in a SQL-statement but I don't manage to get it work. Maybe it isn't possible?

Code exemple:

MapItemnumbertoItemGroup:

MAPPING LOAD  ItemNumber as CompanyItemNumber,

       ItemGroup as CompanyItemGroup;

       SQL SELECT * FROM "MyL_PROD_220".OTSDATA.CompanyItem;

LOAD LONumber,

    Network,

    OrderType,

    LOType,

    TransportCompany as Company,

    TransportFacility as Facility;

  

SQL SELECT *

FROM "MyL_PROD_220".OTSDATA.LOHeader where Network='Interlink' and Status='90';

Left Join

LOAD

    LONumber,

    ApplyMap('MapItemnumbertoItemGroup', ItemNumber, null()) as MaterialItemGroup,

    ReportedQty as MaterialReportedQty,

    ItemNumber as MaterialItemNumber;

 

SQL SELECT * FROM "MyL_PROD_220".OTSDATA.LOMaterial where (ApplyMap('MapItemnumbertoItemGroup', ItemNumber, null())='Tid') ;

Is there any other alternative solution?

My original problem is really that I want to do a select of records from LOMaterial depending on a field (ItemGroup) in CompanyItem.

Thanks in advance!

// Magnus

1 Solution

Accepted Solutions
marcus_sommer

Try this:

MapItemnumbertoItemGroup:

MAPPING LOAD  ItemNumber as CompanyItemNumber,

       ItemGroup as CompanyItemGroup;

       SQL SELECT * FROM "MyL_PROD_220".OTSDATA.CompanyItem;

LOAD LONumber,

    Network,

    OrderType,

    LOType,

    TransportCompany as Company,

    TransportFacility as Facility;

  

SQL SELECT *

FROM "MyL_PROD_220".OTSDATA.LOHeader where Network='Interlink' and Status='90';

Left Join

LOAD

    LONumber,

    ApplyMap('MapItemnumbertoItemGroup', ItemNumber, null()) as MaterialItemGroup,

    ReportedQty as MaterialReportedQty,

    ItemNumber as MaterialItemNumber

where (ApplyMap('MapItemnumbertoItemGroup', ItemNumber, null())='Tid') ;

 

SQL SELECT * FROM "MyL_PROD_220".OTSDATA.LOMaterial;

- Marcus

View solution in original post

4 Replies
marcus_sommer

Try this:

MapItemnumbertoItemGroup:

MAPPING LOAD  ItemNumber as CompanyItemNumber,

       ItemGroup as CompanyItemGroup;

       SQL SELECT * FROM "MyL_PROD_220".OTSDATA.CompanyItem;

LOAD LONumber,

    Network,

    OrderType,

    LOType,

    TransportCompany as Company,

    TransportFacility as Facility;

  

SQL SELECT *

FROM "MyL_PROD_220".OTSDATA.LOHeader where Network='Interlink' and Status='90';

Left Join

LOAD

    LONumber,

    ApplyMap('MapItemnumbertoItemGroup', ItemNumber, null()) as MaterialItemGroup,

    ReportedQty as MaterialReportedQty,

    ItemNumber as MaterialItemNumber

where (ApplyMap('MapItemnumbertoItemGroup', ItemNumber, null())='Tid') ;

 

SQL SELECT * FROM "MyL_PROD_220".OTSDATA.LOMaterial;

- Marcus

magnusrydberg
Partner - Contributor II
Partner - Contributor II
Author

Thanks a lot Marcus it works fine

// Magnus

vinieme12
Champion III
Champion III

ApplyMap()  is native to Qlikview your database will only understand functions native to it for example

you cannot use Oracle db functions on a SQL Server database


Filter the rows in the where clause of the LOAD statement of Qlikview

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.
magnusrydberg
Partner - Contributor II
Partner - Contributor II
Author

Thanks a lot, It works fine

// Magnus