Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I am getting an error when I try to run this script:
LEFT JOIN (E1P)
E1P_Count:
LOAD [SingleAssignment],[SingleAssignment]&[DollarTest] as ConcatField
Resident E1P;
E1P_Count_SmashedField:
LOAD [SingleAssignment], Count(DISTINCT [ConcatField]) as ConcatFieldCount,
If(Count(DISTINCT [ConcatField]) = 1,'SingleAssignmentFlag',
If(Count(DISTINCT [ConcatField]) > 1,'QtyDiffFlag')) as Flag
Resident E1P_Count
GROUP BY [SingleAssignment];
I am trying to add the field, Flag, to my original table, E1P. The error I am getting is:
Table not found error
Table 'E1P_Count' not found
E1P_Count_SmashedField:
LOAD [SingleAssignment], Count(DISTINCT [ConcatField]) as ConcatFieldCount,
If(Count(DISTINCT [ConcatField]) = 1,'SingleAssignmentFlag',
If(Count(DISTINCT [ConcatField]) > 1,'QtyDiffFlag')) as Flag
Resident E1P_Count
GROUP BY [SingleAssignment]
When you do this left join
LEFT JOIN (E1P)E1P_Count:
LOAD [SingleAssignment],[SingleAssignment]&[DollarTest] as ConcatField
Resident E1P;
You are joining data into the E1P table, you are not creating any table named E1P_Count.
When you then try to do this...
E1P_Count_SmashedField:
LOAD [SingleAssignment], Count(DISTINCT [ConcatField]) as ConcatFieldCount,
If(Count(DISTINCT [ConcatField]) = 1,'SingleAssignmentFlag',
If(Count(DISTINCT [ConcatField]) > 1,'QtyDiffFlag')) as FlagResident E1P_Count
GROUP BY [SingleAssignment];
...the table E1P_Count does not exist. Try to do an exit script before this part to examine your datamodel.
How can I add the Flag field to the E1P table?
I would have replaced your first load with an preceding load on the E1P-table. Then do the second join on the E1P-table. Like this:
E1P: LOAD [SingleAssignment],[SingleAssignment]&[DollarTest] as ConcatField
; LOAD Field1, Field2,
SingleAssignment,
DollarTest, ... FieldN FROM E1PSource;
Left JOIN (E1P)
LOAD
[SingleAssignment],
Count(DISTINCT [ConcatField]) as ConcatFieldCount, If(Count(DISTINCT [ConcatField]) = 1,'SingleAssignmentFlag', If(Count(DISTINCT [ConcatField]) > 1,'QtyDiffFlag')) as Flag Resident E1P GROUP BY [SingleAssignment];
I hope this can be of any help. Good luck with finding your solution.
BR Vegar