Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements
Make your voice heard! Participate in the 2020 Wisdom of Crowds® Survey. BEGIN SURVEY
Mattia
Contributor 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

3 Replies
Highlighted
Partner
Partner

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

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

Highlighted
Mattia
Contributor II

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

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

Highlighted
Partner
Partner

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

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