Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I have an issue where concatenate does not perform as i would expect, I'm looking to loop through a number of issues (50 which i've reduced to 2 for ease below) against a table (temp which contains circa 100k)
IssueMap:
Mapping LOAD * INLINE
[
ISSUENO, ISSUE
1, A,
2, B
];
FOR K = 1 to 2
V=ApplyMap('IssueMap',$(K));
IF
$(K) = 1 Then
TEST:
LOAD
$(V) AS NEWIssue,
$(K) AS ROW
RESIDENT TEMP
;
ELSE
TEST:
CONCATENATE
LOAD
$(V) AS NEWIssue,
$(K) AS ROW
RESIDENT TEMP
;
ENDIF
NEXT K
Based on the above I return this -
TEST.NEWIssue | TEST.ROW | TEST-1.NEWIssue | TEST-1.ROW |
---|---|---|---|
A | 1 | - | - |
- | - | B | 2 |
But would have expected / want to see this -
TEST.NEWIssue | TEST.ROW |
---|---|
A | 1 |
B | 2 |
Where am i going wrong / why are -1 variants of the field names being generated?
Thanks for the posts.
Just realised i had a "Qualify" statement in an earlier load tab so when executing the script as the columns already existed when attempting to concatenate the -1 columns were auto generated
IssueMap:
Mapping LOAD * INLINE[
ISSUENO, ISSUE
1, A,
2, B
];
FOR K = 1 to 2
TEST:
LOAD
ApplyMap('IssueMap',$(K)) AS NEWIssue,
'$(K)' AS ROW
AutoGenerate(1);
NEXT
try this
IssueMap:
Mapping LOAD * INLINE
[
ISSUENO, ISSUE
1, A,
2, B
];
FOR K = 1 to 2
V=ApplyMap('IssueMap',$(K));
IF $(K) = 1 Then
TEST:
LOAD
$(V) AS NEWIssue,
$(K) AS ROW
RESIDENT TEMP
;
ELSE
CONCATENATE (TEST)
LOAD
$(V) AS NEWIssue,
$(K) AS ROW
RESIDENT TEMP
;
ENDIF
NEXT K
Thanks for the posts.
Just realised i had a "Qualify" statement in an earlier load tab so when executing the script as the columns already existed when attempting to concatenate the -1 columns were auto generated
Hi
If you are happy with the solutions given here, pl close this thread by marking any helpful and a correct answer.
besides your qualify issue I guess you could replace your loop with a join to improve the performance.
regards
Marco