Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
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

1 Solution

Accepted Solutions
matthias_v
Partner - Contributor III
Partner - Contributor III

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).

View solution in original post

3 Replies
matthias_v
Partner - Contributor III
Partner - Contributor III

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
Partner - Contributor III
Partner - Contributor III

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
Author

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