# Mapping Data Based on Combination of Codes/Number

Hi All,

I would like to hear your idea or case regarding the topic.

What needs to be build is to map the code based on combination of codes/number (please refer to the attached image that describe mapping logic table).

I can create such logic but too much complicated to maintain(Use tons of IF, LEFT, and such).

The table is changed every quarter so that I would like to create the logic in Anaplan as simple as possible.

Do you have any idea or cases that you can share with me regarding that?

If you have any questions, please let me know.

Thanks!

Tagged:

• In a word - Messy!

To avoid a series of IFs, I would, instead, create a series of boolean modules dimensioned by Code to be mapped and the different rule logic for the different codes/number patterns.

Some do not apply, as per your example, Code C, D ,E and F are not applicable for Mapped Codes A-F, so you would set those to TRUE.

You will probably need line items for each pattern, but splitting it up this way is the most efficient, but you will need to update the formulas/add more

Can you post some example data to help understand the formats of Code A - Code F patterns?

It's always easier to work with data than the theory

David

David

• Hi David,

Thanks for your quick response. And yap, it's super complicated.

Here is some examples for each code pattern. (M5 pattern is more complicated so I avoid posting that.)

 Code A M6 2L2111 1820 A2E M15 JAC110A A9B Code B M1 2L2111 1820 A1D A19 JAC440E C8D Code C MD 2MD601 1820 A2E M20 JAC220E B6O Code D MD 2MDJ01 1820 A2E A12 JAC120D E9F Code E M6 2MD601 1850 A1R QRF JAC220E B6O

For example,

Code A: M6(=M6), 2L211(<>2MD5*), 1820(<1829), rest of data can be anything because logic table equals "*".

Thanks!

Mao

• Wow, @DavidSmith

Impressive solution. I knew it could be done in Anaplan.

I think this challenge might be a common one and worth making a best practice out of what you've explained in your word document:

I had to do something similar for a client that needed to convert GL transactions into a common exchange rate based on the cost center, region, and transaction type.

They had a lot of wildcards; for example, if the cost center started with "110" then use a certain value.

I created a system module for each dimension and one that only contained the exceptions (combinations of the three dimensions) instead of creating one for every possible combination. If the combination returned was blank then I knew i didn't need to go any further.

Also a system module that mapped the needed exchange rate.

From there I used the Booleans.

Since most transactions needed no conversion the Booleans filter them out first.

@MaoNinomiya situation is far more complicated than mine but the concepts appear to be the same.

Thanks again for taking the time to build this out. I kept a copy - I'm sure I'll run into this situation again.

• There is always the "why" question

Why do we need to that complexity in the mappings?.  when you resolve through the patterns you often can rationalise and simplify

David

•

Wish you had concluded  by saying Pattern Logic - Magic Code instead of Pattern Logic - Match Code:)

Thanks,

Misbah

•

Especially for you!!!

•

Haha! Thank you so much

• Great solution @DavidSmith thanks for shaining!

This is complex but it a great solution for avoiding large if statements!

• Thanks, David!

Your solution is almost the same with my proposal to the client (So I was relieved to hear your solution).