Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I have a load sequence below which is getting me the correct values out but i want to be able to change which Mapped group some of the bname's get applied to (like a manual override as such)
Current Code:
------------------------------------------------------------------------------------------------------------------------------------------------------------------
bnewstructure:
Mapping LOAD
B_DESC AS [bname],
B_GROUP AS [bgroup]
FROM
bnewstructure:
(qvd);
MAPPING:
MAPPING LOAD * inline [
In, Out
Grouped cos, Grouped companies];
map [Mapped group] using MAPPING;
Details:
load
ApplyMap('bnewstructure:',[B name],'Missing') as [Mapped group],
*;
LOAD
boldstructure.B_DESC as [B name]
FROM
[$(vDetailsQVDDirectory)\boldstructure.qvd]
(qvd);
------------------------------------------------------------------------------------------------------------------------------------------------------------------
This outputs for example
[Mapped group] [B name]
group1 john
group1 alan
group1 paul
group2 matt
group2 doug
------------------------------------------------------------------------------------------------------------------------------------------------------------------
How can i manipulate the data to override which [Mapped group] a [B name] gets applied to. Do i use an if statement inside an applymap or an applymap inside an applymap etc?
------------------------------------------------------------------------------------------------------------------------------------------------------------------
For example change the above to:
This outputs for example
[Mapped group] [B name]
group1 john
group1 alan
group2 paul
group2 matt
group2 doug
I solved this by doing:
bnewstructure:
Mapping LOAD
B_DESC AS [bname],
B_GROUP AS [bgroup]
FROM
bnewstructure:
(qvd);
MAPPING:
MAPPING LOAD * inline [
In, Out
Grouped cos, Grouped companies];
map [Mapped group] using MAPPING;
Details:
load
IF(match([B name],'paul'),'group2',ApplyMap('bnewstructure:',[B name],'Missing')) as [Mapped group],
*;
LOAD
boldstructure.B_DESC as [B name]
FROM
[$(vDetailsQVDDirectory)\boldstructure.qvd]
(qvd);
anyone?
Would you be able to share few lines of data with expected output to help you?
Current output
[Mapped group] [B name]
group1 john
group1 alan
group1 paul
group2 matt
group2 doug
expected output
[Mapped group] [B name]
group1 john
group1 alan
group2 paul
group2 matt
group2 doug
Right but what data are you using to create this? Unless I have the raw data, I won't be able to help much
i was thinking something like editing the first mapping code from:
bnewstructure:
Mapping LOAD
B_DESC AS [bname],
B_GROUP AS [bgroup]
FROM
bnewstructure:
(qvd);
TO something like
bnewstructure:
Mapping LOAD
B_DESC AS [bname],
IF(B_DESC = 'paul', 'group2', B_GROUP) AS [bgroup]
FROM
bnewstructure:
(qvd);
Sure, try it out. I won't be able to offer much unless I have an example to look at. But what you have listed above make sense
I solved this by doing:
bnewstructure:
Mapping LOAD
B_DESC AS [bname],
B_GROUP AS [bgroup]
FROM
bnewstructure:
(qvd);
MAPPING:
MAPPING LOAD * inline [
In, Out
Grouped cos, Grouped companies];
map [Mapped group] using MAPPING;
Details:
load
IF(match([B name],'paul'),'group2',ApplyMap('bnewstructure:',[B name],'Missing')) as [Mapped group],
*;
LOAD
boldstructure.B_DESC as [B name]
FROM
[$(vDetailsQVDDirectory)\boldstructure.qvd]
(qvd);
Awesome
I am glad you were able to figure it out all by yourself. This will go a long way in helping you learn faster