Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Add 2 fields in mapping

Hi there,

I'm like a newbie in Qlikview, and I've got a little something that I can't make. Right now, I've got this :

agent:

MAPPING LOAD * inline [

Old ,New

"MO", "Maladie ordinaire"

"AT", "Accident de travail"

"MA", "Maternité"

"ML", "Longue Maladie"

"MD", "Longue durée"

];

map[raison] using agent;

But the thing is, to build "Maternité", I need more that the code "MA", I need also the code "CP" and the "GP" one. So in this way, the number of MA will add itself to the CP one, and to the GP one, to build the "Maternité" right number.

FYI : the agent table is build that way (for a month, we count the amount of day missed, and why. If there are two reasons, you've got the amount of time for the first reason, and on an other line, the second one)

LOAD

     IDF_AGENT,

     NUM_ANNEE as num_annee,

     NUM_MOIS as num_mois,

     count(NUM_JOUR) as NbJourAbsence,

     COD_ARRET as raison

RESIDENT

     table_calendrier

GROUP BY

     IDF_AGENT,NUM_ANNEE,NUM_MOIS,COD_ARRET;

How to do that ? Thanks a lot !

1 Solution

Accepted Solutions
swuehl
MVP
MVP

If I understood correctly, it should be enough to add the mappings to the mapping table:

agent:

MAPPING LOAD * inline [

Old ,New

"MO", "Maladie ordinaire"

"AT", "Accident de travail"

"MA", "Maternité"

"GP", "Maternité"

"CP", "Maternité"

"ML", "Longue Maladie"

"MD", "Longue durée"

];

View solution in original post

6 Replies
swuehl
MVP
MVP

Could you please post some sample lines of your data and your requested result for those records?

Map raison using agent;

is just mapping your input values to the values in your mapping tables when storing them to the internal table, it seems hard to apply any additional logic at that point.

Not applicable
Author

So I want smth like that :

IDF_AGENTNUM_MOISNUM_ANNEENbrJourAbsenceRaisonFamille
1220123CPMaternité
1220125MAMaternité
15201225GMGrave Maladie
512201130MPMaladie Professionnelle

I've got 13 differents codes, and I want to regroup them by "family".

Code => Familiy

CP-GP-MA => "Maternité"

GM => "Grave Maladie"

...

The "Map raison using agent;" is something I tried, but it was a failure !

But right now, I'm not able to find the solution for the "Family" row, and I thought it was something in the mapping.

swuehl
MVP
MVP

If I understood correctly, it should be enough to add the mappings to the mapping table:

agent:

MAPPING LOAD * inline [

Old ,New

"MO", "Maladie ordinaire"

"AT", "Accident de travail"

"MA", "Maternité"

"GP", "Maternité"

"CP", "Maternité"

"ML", "Longue Maladie"

"MD", "Longue durée"

];

Not applicable
Author

But with that, It'll create 3 differents occurrences of Maternité, instead of adding the 3 codes between themselfes.

swuehl
MVP
MVP

Sorry, I don't get what you mean by adding the 3 codes.

agent:

MAPPING LOAD * inline [

Old ,New

"MO", "Maladie ordinaire"

"AT", "Accident de travail"

"MA", "Maternité"

"GP", "Maternité"

"CP", "Maternité"

"ML", "Longue Maladie"

"MD", "Longue durée"

];

Map Famille using agent;

LOAD IDF_AGENT,

    NUM_MOIS,

    NUM_ANNEE,

    NbrJourAbsence,

    Raison,

    Raison as Famille

FROM

[http://community.qlik.com/thread/97607]

(html, codepage is 1252, embedded labels, table is @1);

This creates a table like you posted above, so you can use Famille to group your data, Codes MA,CP,GP will fall under Maternité.

Not applicable
Author

Let it go, I'm an idiot. I've tried this earlier, but I don't know what was my mistake, in this time it works. Sorry to have disturbed you.