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

Question about Mapping and Dual


The Script below works well. But I have a question, why do I get 0 and 1 as the outcome in the table and not the text Purchase and Sales when I use the original fieldname [Entry Type]? If I create a new field [Entry Type Dual] I do get the expected result with the text!

EntryTypeMap:

MAPPING LOAD * INLINE [

     EntryTypeNum, EntryTypeDesc

     0, Purchase

     1, Sales

];

ItemLedgerEntry;

Load

     dual(ApplyMap('EntryTypeMap', [Entry Type]), [Entry Type]) as  [Entry Type Dual],

     dual(ApplyMap('EntryTypeMap', [Entry Type]), [Entry Type]) as  [Entry Type]

Residend abc;

Any idea?

Regards,

Gerrit

Tags (2)
1 Solution

Accepted Solutions
matthias_v
Not applicable

Re: Question about Mapping and Dual

Hi Gerrit,

QlikView will always decide the number formatting of a field the first time this field is loaded. So because of the facts that:

1) QlikView has identified this fieldname with the NUM-format when it first loaded this field.

2) you are reusing this fieldname.

; QlikView will use the NUM-format as the default format for your dual-value. This also explains that when you give the field another name, it does use the TEXT-format as default (as it usually does with dual-values).

3 Replies
matthias_v
Not applicable

Re: Question about Mapping and Dual

Hi Gerrit,

QlikView will always decide the number formatting of a field the first time this field is loaded. So because of the facts that:

1) QlikView has identified this fieldname with the NUM-format when it first loaded this field.

2) you are reusing this fieldname.

; QlikView will use the NUM-format as the default format for your dual-value. This also explains that when you give the field another name, it does use the TEXT-format as default (as it usually does with dual-values).

matthias_v
Not applicable

Re: Question about Mapping and Dual

Not sure about that one, I don't think this is possible. You can however use a renamed field as the inputfield for your applymap.

E.G.:

ItemLedgerEntry;

Load

     *,

     tt_EntryType                                                                                   as EntryTypeCode,

     dual(ApplyMap('EntryTypeMap', tt_EntryType), tt_EntryType) as  [Entry Type]

Residend abc;

DROP FIELD tt_EntryType FROM ItemLedgerEntry;

Offcourse this implicates that you do a rename to tt_EntryType on your original load.

Not applicable

Re: Question about Mapping and Dual

Matthias, 

Ok, I can achieve that via a workaround.

But I can also live with the renamed field in my original solution, I was just curious.

Thanks again.

Regards,

Gerrit