Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I load my data like this
ajouts1:
LOAD HKUNNR as Hiérar,
VTWEG as ncanaux
FROM
C:\Users\*******\Desktop\modele\Data_Common\KNVH.QVD
(qvd);
join (ajouts1)
ajouts2:
LOAD [VTWEG] as ncanaux,
if([VTWEG]='20','rgpGMS',
if([VTWEG]='23' or [VTWEG]='24','rgpIndus',
if([VTWEG]='21','rgpRHF',
if([VTWEG]='25','rgpAutre',
)))) as [New Canal distri]
FROM
C:\Users\*******\Desktop\modele\Data_Common\KNVH.QVD
(qvd);
STORE ajouts1 Into ..\..\Data_Common\transition.QVD(qvd);
DROP Table ajouts1;
LOAD Hiérar,
ncanaux,
[New Canal distri]
FROM
C:\Users\*******\Desktop\modele\Data_Common\transition.QVD
(qvd);
so, in my database, i have 2 fields : "canaux" and "hiérarchie".
"hiérarchie" is like "H2xxxxxx", "H4xxxxxx", "H6xxxxxx", "H8xxxxxx".
"canaux" is like "20", "21", "22", "23", "24",, "25".
I want add a new model of "canaux" like this :
"20" = 20 and rgpGMS
"23" or "24" = "23" or "24" and rpgindus
"21" = 21 and rgpRHF
"25 = 25 and rgpAutre
BUT !, an entry in canaux named "22" can be in each of the others, "canaux","22" can be rgpGMS, rgpIndus, rgpRHF or rgpAutre. This is referenced by the field "hiérarchie" because one "hiérarchie" can have lot of "canaux" but a "canaux" can only have one "hiérarchie".
How to do this, thanks for yours suggestions
thanks for your help
Not exactly, Previous() returns the previous value of the field, Peek() searches for a value in a field, and in both cases can be used for tables which are being loaded, not for already loaded tables (like ApplyMap() for example that requires an existing table to work). In several cases you want both, e.g.: if the previous value for Date is today, store the value in field X into field Y or
If(Previous(Date) = Today(), Peek('CurrentRate'), 0) AS MostCurrentRate
I was suggesting that because I don't know in your source or data model how this "22" value can appear or how to build a key so you can use that one to search for the corresponding value (so it would take the value from 20 or 25 respectively in your examples above).
There must be a way that you can identify to which combination of values that 22 belongs, and then set the value while you are loading, that could be the hierarchy and the other channel, or a timestamp, for example.