Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi everyone,
I'm facing a problem with the ApplyMap() script-function.
I'm using an Inline table to map groups to different codes like this:
Mapping_Ausschusscodes:
Mapping LOAD * INLINE [
AS_CODE , Auschussgruppe
Code1 , Gruppe1
Code2 , Gruppe1
Code3 , Gruppe2
Code4 , Gruppe2
Code5 , Gruppe1
]
;
In my facttable it looks like this:
Ausschuss:
LOAD * AS_CODE
AS Ausschusscode,
ApplyMap('Mapping_Ausschusscodes' , AS_Code , 'Fehler')
AS Ausschussgruppe
...
FROM Ausschuss.qvd (qvd)
;
In addition to that I want to map colours to the different Groups so I built a table like this:
Farbcodes_Ausschussgruppen_tmp:
LOAD * INLINE [
Ausschussgruppe , Red , Green , Blue
Gruppe1 , 0 , 80 , 140
Gruppe2 , 255 , 255 , 0
]
;
Mapping_Clr_AS_Gruppe:
MAPPING LOAD Ausschussgruppe,
RGB(Red,Green,Blue)
AS Clr_AS_Gruppe
RESIDENT Farbcodes_Ausschussgruppen_tmp
;
Drop table Farbcodes_Ausschussgruppen_tmp
;
In the ende the code in the facttable looks like this:
Ausschuss:
LOAD * AS_CODE as Ausschusscode,
ApplyMap('Mapping_Ausschusscodes' , AS_Code , 'Fehler')
AS Ausschussgruppe
// ...
FROM Ausschuss.qvd (qvd)
;
/*I made an extra table for the colourcoding because I could not apply the map on the newly created field 'Ausschussgruppe'*/
Farbcodierung:
LOAD Ausschussgruppe,
ApplyMap('Mapping_Clr_AS_Gruppe' , Ausschussgruppe , RGB(90,91,90))
AS Clr_AS_Gruppe
RESIDENT Ausschuss
;
Now QlikView creates a synthetic Key, I think because of the double use of 'Ausschussgruppe'. Is there a way to apply the colourmap to the newly created field without creating a synthetic key/table?
Or is there a way to integrate the RGB-Codes into the first mappingtable?
Thanks in advance! 🙂
AR
map both steps in one line
ApplyMap('Mapping_Clr_AS_Gruppe' , ApplyMap('Mapping_Ausschusscodes' , AS_Code , 'Fehler') , RGB(90,91,90))
AS Clr_AS_Gruppe
regards
map both steps in one line
ApplyMap('Mapping_Clr_AS_Gruppe' , ApplyMap('Mapping_Ausschusscodes' , AS_Code , 'Fehler') , RGB(90,91,90))
AS Clr_AS_Gruppe
regards
Thanks for your quick answer. It works. Didn't know that ApplyMap can be nested. 🙂