Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
cliff_clayman
Creator II
Creator II

Resident LOAD not working properly

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]

Labels (1)
3 Replies
Vegar
MVP
MVP

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 Flag

Resident 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.

cliff_clayman
Creator II
Creator II
Author

How can I add the Flag field to the E1P table?

Vegar
MVP
MVP

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