Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi guys, I have this script to have as output a text field present in the mapping table:
In your opinion, there are mistakes. Because I've really tried everything, but the applymap always gives me the Null.
I tried to copy and paste the table (inline) and instead it takes the values. So, I wonder, what could be the problem?
Mapping
map1:
LOAD
codcausale,
specifcaus;
SELECT "vsql_id",
"vsql_pk",
"codcausale",
"specifcaus",
"desccaus",
"codreg",
"causautom",
"mastro_iva",
"conto_iva",
"sottoc_iva",
"tipodoc_telematico_fatture",
"scritture_provvisorie",
"vsql_user_ins",
"vsql_user_ultmod",
"vsql_dataora_ins",
"vsql_dataora_ultmod"
FROM "okw"."tabcausa";
Giornale:
LOAD
vsql_id,
vsql_pk,
vsql_annocontabile,
codcausale,
codregcont,
protocollo,
datareg,
numdoc,
datadoc,
descriz,
numpartita,
applymap('map1', codcausale, null()) as New;
SELECT "vsql_id",
"vsql_pk",
"vsql_annocontabile",
"codcausale",
"codregcont",
"protocollo",
"datareg",
"numdoc",
"datadoc",
"descriz",
"numpartita"
FROM "okw"."giornale";
(Codcausal is a text type field)
The good syntaxe is
map1:
Mapping Load
Not
Mapping
map1:
Load
So you can try this :
map1:
Mapping LOAD
codcausale,
specifcaus;
SELECT "vsql_id",
"vsql_pk",
"codcausale",
"specifcaus",
"desccaus",
"codreg",
"causautom",
"mastro_iva",
"conto_iva",
"sottoc_iva",
"tipodoc_telematico_fatture",
"scritture_provvisorie",
"vsql_user_ins",
"vsql_user_ultmod",
"vsql_dataora_ins",
"vsql_dataora_ultmod"
FROM "okw"."tabcausa";
Giornale:
LOAD
vsql_id,
vsql_pk,
vsql_annocontabile,
codcausale,
codregcont,
protocollo,
datareg,
numdoc,
datadoc,
descriz,
numpartita,
applymap('map1', codcausale, null()) as New;
SELECT "vsql_id",
"vsql_pk",
"vsql_annocontabile",
"codcausale",
"codregcont",
"protocollo",
"datareg",
"numdoc",
"datadoc",
"descriz",
"numpartita"
FROM "okw"."giornale";
Enjoy your Qlik.
Kind regards,
Théo ATRAGIE.
Hi,
try this:
map1:
Mapping LOAD
codcausale,
specifcaus;
SELECT
"codcausale",
"specifcaus"
FROM "okw"."tabcausa";
Giornale:
LOAD
vsql_id,
vsql_pk,
vsql_annocontabile,
codcausale,
codregcont,
protocollo,
datareg,
numdoc,
datadoc,
descriz,
numpartita,
applymap('map1', codcausale, null()) as New;
SELECT "vsql_id",
"vsql_pk",
"vsql_annocontabile",
"codcausale",
"codregcont",
"protocollo",
"datareg",
"numdoc",
"datadoc",
"descriz",
"numpartita"
FROM "okw"."giornale";
Best regards Son
Thank You!
I fixed it as you suggested, but it still doesn't work properly. That is absurd, because if I create the same table with the INLINE command, copying and pasting the two fields, the mapping works.
map1:
Mapping
LOAD
codcausale,
specifcaus;
SELECT "vsql_id",
"vsql_pk",
"codcausale",
"specifcaus",
"desccaus",
"codreg",
"causautom",
"mastro_iva",
"conto_iva",
"sottoc_iva",
"tipodoc_telematico_fatture",
"scritture_provvisorie",
"vsql_user_ins",
"vsql_user_ultmod",
"vsql_dataora_ins",
"vsql_dataora_ultmod"
FROM "okw"."tabcausa";
Tabella1:
LOAD
vsql_id,
vsql_pk,
vsql_annocontabile,
// codcausale,
codregcont,
protocollo,
datareg,
numdoc,
datadoc,
descriz,
numpartita,
ApplyMap('map1', codcausale, 'nessuno') as New;
SELECT "vsql_id",
"vsql_pk",
"vsql_annocontabile",
"codcausale",
"codregcont",
"protocollo",
"datareg",
"numdoc",
"datadoc",
"descriz",
"numpartita"
FROM "okw"."giornale";
Add noconcatenate before the creation of your mapping table.
Very kind.
Can you please confirm that I have well understood the position of the noconcatenate?
I removed the "mapping" statement, using a drop table at the bottom, and that's the only way it works at the moment.
I used the exact same logic with two other mapping tables and no problem. This one, on the other hand, does not want to know anything about working in the traditional way.
Try to remove semicolon from mapping load:
Thank you for your reply.
I removed the mapping statement and everything seems to be working properly.
I wonder, once a mapping is set up, to add other mappings (a second, third and so on) it is necessary to repeat the "mapping" command or can Qlik read it by itself, if the mappings are consecutively columned?
Each mapping table needs a separate mapping statement and will create an own independent table which are automatically removed when the script has finished.
There is no limitation how many mapping tables are created.