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

Probably wrong expression: mapping load, apply map, wildmatch, left, right

Hi QV users,

i've a problem with the following expressions in the script:

KEY_TO_VALORE_PRESTAZIONE:
Mapping LOAD
[@10:17] as CONTATORE_PRESCRIZIONE,
[@37:45] as VALORE_PRESTAZIONE

If(WildMatch(ApplyMap('KEY_TO_VALORE_PRESTAZIONE',[@10:17],'n/a'),[@306:306]='0'),Left([@37:45],7) & ',' & Right([@37:45],2),0) as VALORE

The field [@10:17] as CONTATORE_PRESCRIZIONE is the key field between table "T" and table "D".

The output i want to obtain is a new field called "VALORE" that if the field [@306:306] of table "T" contains the value "0", return the first 7 numbers of the field [@37:45] of table "D", a comma, and the last 2 numbers of the same field of table "D".

Please, can someone show me the right direction?

Thanks,

Mattia

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

Try splitting the wildmatch and applymap using preceeding load:

KEY_TO_VALORE_PRESTAZIONE:
Mapping LOAD
[@10:17] as CONTATORE_PRESCRIZIONE,
[@37:45] as VALORE_PRESTAZIONE

 

load*,If(WildMatch([@306:306],'0'),Left(Val,7) & ',' & Right(Val,2),0)as VALORE ;

load *,ApplyMap('KEY_TO_VALORE_PRESTAZIONE',[@10:17],'n/a')as Val

Mattia
Creator II
Creator II
Author

Hi Jkfong93,

thanks for the message but something not runs.

When i reload the script, QV tell me that the field [@306:306] is not found.

I've inserted the two conditions after the following script:

LOAD...;

load*,If(WildMatch([@306:306],'0'),Left(Val,7) & ',' & Right(Val,2),0)as VALORE ;

load *,ApplyMap('KEY_TO_VALORE_PRESTAZIONE',[@10:17],'n/a')as Val

FROM...

What's wrong?

Thanks,

Mattia

Arthur_Fong
Partner - Specialist III
Partner - Specialist III

Does this "FROM...?" table has the field [@306:306] ?