Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Mattia
Creator II
Creator II

Can someone help me with this expression?

Hi guys,

i've a problem with the following query, in particular with this script:

If(WildMatch(ApplyMap('KEY_TO_BS_STS21',ApplyMap('DOUBLE_MAPPING',[@10:17],'n/a')),008), If([@4:9]=030357,'PS_RADIO','RADIO'),
If(WildMatch(ApplyMap('KEY_TO_BS_STS21',ApplyMap('DOUBLE_MAPPING',[@10:17],'n/a')),'011'), If([@4:9]=030357,'PS_LAB','LAB')))

as new_field

With these conditions, also the rows n°4 and  n°19 it should be valued, respectively with "PS_RADIO" and "PS_LAB".

Why it don't work? It's a problem of data format, syntax (brackets) or something else?

Attached is a sample data file.

The strange thing is that if i insert a inline table, the query works perfectly (see another attached file).

The output that i want to obtain is the following: if the field BS_STS21 = 008 and if the field CODICE_PRESIDIO = 030357, the record must show PS_RADIO, instead RADIO; if the field BS_STS21 = 011 and if the field CODICE_PRESIDIO = 030357, the record must show PS_LAB, instead LAB. All the records must have a value in the column TIPO.

Please, someone could show me the right direction?

Thanks,

Mattia

Labels (1)
6 Replies
Arthur_Fong
Partner - Specialist III
Partner - Specialist III

Why there is 2 mapping table of the same column?

Which field should mapped with if there is 2 identical match? eg: 04111 and 05111


KEY_TO_NOTA:
Mapping LOAD * INLINE [
FIELD3, FIELD4
0443, -
0529, -
3869, -
04111, IHca
06111, -
05111, Ihmac
0442, -
0441, -
0440, -
];

KEY_TO_BS_STS21:
Mapping LOAD * INLINE [
FIELD3, FIELD4
0443, 021
0529, 008
3869, 008
04111, 021
06111, 011
05111, 021
0442, 011
0441, 021
0440, 021
];

Arthur_Fong
Partner - Specialist III
Partner - Specialist III

In your Actual sample, i dont see this issue:

KEY_TO_NOTA:
Mapping LOAD
CODICE_PRESTAZIONE,
NOTA

FROM
[C:\Users\Baronim\Desktop\2019_Tariffario_C.xlsx]
(ooxml, embedded labels, table is Tariffario);

KEY_TO_BS_STS21:
Mapping LOAD
CODICE_PRESTAZIONE,
BS_STS21

 

Can you please check again?

Mattia
Creator II
Creator II
Author

Hi Arthur,

i'm agree but the query that i need is in the other attachment.

I don't know why but this query (that is made by sample data) works perfectely, while the query i need don't work!  

Mattia
Creator II
Creator II
Author

I'm sorry Arthur, i don't understand the problem.

The only query that i need is in the QV named Sample_data_P.

StarinieriG
Partner - Specialist
Partner - Specialist

Buonasera Mattia,

 

il problema sembra nascere dal fatto che per ciascun CONTATORE_PRESCRIZIONE ci sono più CODICE_PRESTAZIONE. Di conseguenza il mapping prende uno dei tanti valori possibili.

 

Per risolvere bisogna usare la giusta chiave nel mapping, in modo che il collegamento sia 1:1

Mattia
Creator II
Creator II
Author

Grazie mille per il suggerimento!

In realtà ho già risolto utilizzando la funzione Left Join mettendo da parte ApplyMap che non mi dava il risultato desiderato.

Mattia