Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi everyone,
I have some data in one field called "Ires" and "Irap" and i want to change their name in "Imposte". the field is named "DESC_GRP".
this is my script that doesn't work
Tabella_riclassificato:
LOAD DESC_GRP,
If(DESC_GRP='Ires','Imposte',IF(DESC_GRP='Irap','Imposte',DESC_GRP)) AS DESC_GRP;
SQL SELECT IND, TIPO, CODICE, DESCRIZIONE, SUBTOTALI, GRUPPO, CDC_SBT, DESC_GRP, CONTO_RICLASSIFICATO
FROM GIMETAL_RICLASSIFICATO
any idea?
THANKS
to rename fialed use
Rename Field XXX to YYYY;
and if I understtod correctly
LOAD *,
If(DESC_GRP='Ires','Imposte',IF(DESC_GRP='Irap','Imposte',DESC_GRP)) AS DESC_GRP;
SQL SELECT IND, TIPO, CODICE, DESCRIZIONE, SUBTOTALI, GRUPPO, CDC_SBT, DESC_GRP, CONTO_RICLASSIFICATO
FROM GIMETAL_RICLASSIFICATO
Your post title is a little bit misleading. what you really wanted was transform your data. the if statement in your script is correct. however, the problem is that you are naming the transformed field the same as an existing field. QV will not allow the same field name used more than once. how about:
Tabella_riclassificato:
LOAD DESC_GRP,
If(DESC_GRP='Ires','Imposte',IF(DESC_GRP='Irap','Imposte',DESC_GRP)) AS DESC_GRP_TRANSFORMED;
....
I would like to maintain the same name because I have several expressions working with this field name.
@Supertendi You could write match function as well to simplify . Also try to use trim with lower function to make sure that it should written value when there is white spaces or case mistamtch
LOAD *,
If(match(lower(trim(DESC_GRP)),'ires','irap'),'Imposte',DESC_GRP)) AS DESC_GRP;
SQL SELECT IND, TIPO, CODICE, DESCRIZIONE, SUBTOTALI, GRUPPO, CDC_SBT, DESC_GRP, CONTO_RICLASSIFICATO
FROM GIMETAL_RICLASSIFICATO;
you cant have the same field name twice in same table. you can switch the field names if you want:
Tabella_riclassificato:
LOAD DESC_GRP as SOMEOTHERNAME,
If(DESC_GRP='Ires','Imposte',IF(DESC_GRP='Irap','Imposte',DESC_GRP)) AS DESC_GRP;
.
this will fail as DESC_GRP will appear twice
Hi,
it says syntax error: FROM missing or misplaced...