Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements

Breathe easy -- you now have more time to plan your next steps with Qlik!
QlikView 11.2 Extended Support is now valid through December 31, 2020. Click here for more information.

Not applicable

Applymap change

Our team's Qlikview developer has changed the underlying data model and moved the DESK field, from a table called TRADES to another one called TRADESPLITS. Therefore my mapping script below no longer works, as i now get the error;

"Field not found - <DESK>"

My script is as follows

MapProduct:

Mapping LOAD

DESKS & SECTORS as Key,

     PRODUCT

Resident ProductMappings;

TRADES:

LOAD

*,

ApplyMap('MapProduct',DESK,ApplyMap('MapProduct',SECTOR, Null())) as PRODUCT

Resident Trade_Temp;

Drop Tables  Trade_Temp,ProductMappings;

How can I amend this segment of the script to ensure it works? Previously the SECTOR field and DESK field were both in the TRADES table.

The full script is attached for extra clarity if needed.

Tags (1)
8 Replies
sujeetsingh
Honored Contributor III

Re: Applymap change

Try applying first Applymap and then use the field in next one

sujeetsingh
Honored Contributor III

Re: Applymap change

Better if you use two Maping tables

martynlloyd
Contributor III

Re: Applymap change

Sounds like you need to join TRADES with TRADESPLITS

TRADES:

LOAD

*,

...

;

Left Join (TRADES)

LOAD

Key1,

Key2,

ApplyMap('MapProduct',DESK,ApplyMap('MapProduct',SECTOR, Null())) as PRODUCT

Resident TRADESPLITS

;

Not applicable

Re: Applymap change

Would this not duplicate the data in the TRADES table though? Currently one trade can have many splits, so is it wise to change that architecture?

Not applicable

Re: Applymap change

What exactly do you mean? One for the SECTOR field and one for the DESK field?

martynlloyd
Contributor III

Re: Applymap change

Woops!

Yes, you need to Load Distinct after the join.

The result will depend on your data in TRADESPLITS.

Marty.

martynlloyd
Contributor III

Re: Applymap change

Hi Alex,

Given the fundamental change to your data model, I'm wondering maybe you should reconsider your approach, and accepting that DESK is now in the other table, you should map PRODUCT in that table.

I take it that both tables exist in the App? Better to use a little bit of memory and keep it simple...

Regards,

Marty.

Not applicable

Re: Applymap change

Hi Alex, As per my understanding, you changes the table structure (field names). So on QVD Loader stage rename the fields into OLD field names to avoid other changes on the Design Layer.