Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Not applicable

Help on Applymap Statement

Hi Community

I have a problem with an applymap statement as it's not applying the map for some reason and i am lost why it's not working hopefully you can help me

the code is as below:

//******************************************************************************** LOAD MAPPING TABLES ***********************************************************************************//

KACParentAccountDetails:

Mapping

LOAD CompanyDetails.CompanyCode,

     CompanyDetails.AccountContractManagerName

FROM

C:\Users\Manager\Dropbox\Qlikview\KA\KACParentAccountDetails.qvd

(qvd);

//******************************************************************************** LOAD MAIN DATA TABLES ***********************************************************************************//

KAmaster:

LOAD CompanyDetails.CompanyID,

     CompanyDetails.CompanyCode,

     CompanyDetails.ParentAccountID,

     Applymap('KACParentAccountDetails',CompanyDetails.ParentAccountID,'') as ContractManagerName,

     CompanyDetails.AccountContractManagerName

FROM

C:\Users\Manager\Dropbox\Qlikview\KA\CompanyDetails.qvd

(qvd)

Tags (1)
1 Solution

Accepted Solutions
vidyut
Contributor II

Re: Help on Applymap Statement

Hi James,

Problem is with the ParentCompanyID, which is in Text Format instead of Number due to training spaces etc. So it you use

Applymap('KACParentAccountDetails',Num(Trim(CompanyDetails.ParentAccountID)), '') as ContractManagerName,

This should resolve your issue.

Hint: When you put a listbox for a field, the text is left aligned, and the numbers are right aligned.


8 Replies
mov
Esteemed Contributor III

Re: Help on Applymap Statement

James,

I don't see anyhting wrong with the script. Except, I recommend to use always mapping load distinct, except for inline load.  If anything is wrong, it is likely with the data.

Regards,

Michael

Not applicable

Re: Help on Applymap Statement

Hi Michael

both CompanyDetails.ParentAccountID and CompanyDetails.CompanyCode are numerical fields, i have added a test app to this post if you need to see the data behind the code!

Regards

James

vidyut
Contributor II

Re: Help on Applymap Statement

Hi James,

I don't see anything wrong with your script. Will you be able to provide the Mapping Load QVD File?

Regards,

Vidyut

Not applicable

Re: Help on Applymap Statement

Hi Vidyut

Mapping File is attached now.  thanks

vidyut
Contributor II

Re: Help on Applymap Statement

Now, Could you please find a Company in KAMaster with a Parent Company ID that is present in this Mapping QVD? That would help in resolving your issue.

Thanks,

Vidyut

Not applicable

Re: Help on Applymap Statement

the parent 547348 should linked to 32 child account vidyut

vidyut
Contributor II

Re: Help on Applymap Statement

Hi James,

Problem is with the ParentCompanyID, which is in Text Format instead of Number due to training spaces etc. So it you use

Applymap('KACParentAccountDetails',Num(Trim(CompanyDetails.ParentAccountID)), '') as ContractManagerName,

This should resolve your issue.

Hint: When you put a listbox for a field, the text is left aligned, and the numbers are right aligned.


Not applicable

Re: Help on Applymap Statement

Thanks Vidyut

so your converting the field to a number then using trim to remove all training spaces etc, you have been a great help

Community Browser