Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hey,
I'm trying to use ApplyMap() function in Qlikview in order to retreive some data corresponding to an ID from another table.
I have two tables "parties" and "orders". In orders, I have many fields like "Attribute0" which corresponds to the client's name. This attribute "Attribute0" can be numeric or alphanumeric.
The table "parties" have two fields PARTY_ID and PARTY_NAME.
My objective is to replace Attribute0 by the "PARTY_NAME" corresponding to the "PARTY_ID" when Attribute0=PARTY_ID everytime I have numeric value in Attribute0.
I didn't know how to proceed ... I created two scripts:
Mapping:
Mapping:
Mapping load
PARTY_ID,
PARTY_NAME;
SQL SELECT distinct
PARTY_ID,
PARTY_NAME
FROM hz_parties;
Commande:
load
text(ORDER_NUMBER) as [NuméroCde],
ATTRIBUTE0 as [ClientFinal],
IF(ISNUM(ATTRIBUTE4),ATTRIBUTE4, ) AS PARTY_ID,
IF (ISNUM(ATTRIBUTE4),APPLYMAP('Mapping', PARTY_ID)) as [ClientFinal];
select distinct
t1.ORDER_NUMBER ,
t1.ATTRIBUTE0,
from
OE_ORDER_HEADERS_ALL t1;
I have errors like "PARTY_ID uknown" while exeuting the script. Can any one help me to resolve this problem please ?
Thanks
Hi,
Mapping is a keyword in QlikView. You are using the same for table name.
Not sure if this is fine.
thanks,
Rajesh Vaswani
Merci pour votre remarque, mais je l'ai changé en PartyMapping (afin d'avoir un nom plus significatif).
Le problème de mot réservé à QV ne se pose plus donc
Le problème a été résolu.
Pour ceux qui sont intéressés, ApplyMap() ne regarde pas les noms de champ (c'était ma première faute car je voulais faire un renommage qui n'a pas marché).
Cette fonction ne m'a pas donné par la suite les résultats attendus (il remplace par null au lieu de la valeur attendue). Le problème était dans la position de la déclaration de la table de Mapping.
Le problème a été résolu quand j'ai placé la déclaration de la table de mapping juste avant la déclaration de ma table.
PartyMapping:
Mapping load
PARTY_ID,
PARTY_NAME;
SQL SELECT
PARTY_ID,
PARTY_NAME
FROM hz_parties;
Cde:
LOAD
Mes paramètres;
SELECT
Mes paramètres;
Je vous remercie tous pour votre réactivité. J'apprends beaucoup de choses avec vous.