Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I'm trying to use the field MeterReference to identify the name of the company (AccName) for that individual meter (left join at the bottom). I can then use the AccountName to split into qvd files of readings for that company.
Current effect is that the loop doubles the number of rows each iteration (e.g. 2400, 4800, 9600.. and so on...)
MetRefTemp table
AccNam | AccountId | MeterReference |
Company A | e4741f2f-#########-###### | METER A |
Company A | e4741f2f-#########-###### | METER B |
... | ... | ... |
Company B | 4c3d8138-#########-###### | METER ZZZZ |
What ENMATReadings is pulling through is;
MeterReference | ReadingsID | ReadingDateTime | RptTime | Value_Amount (kWh) |
METER A | 0001A | 10/10/2022 09:00 | 09:00 | 95461.05 |
METER B | 0002A | 10/10/2022 09:00 | 09:00 | 95462 |
... | ... | ... | ... | ... |
METER ZZZZ | B0001T | 11/10/2022 09:30 | 09:30 | 94111 |
// Get readings from meter references in MetRefTemp table
let vMeterRows=NoOfRows('MetRefTemp');
[ReadingsTemp]:
LOAD * INLINE [
MeterReference, ReadingsID, ReadingDateTime, RptTime, Value_Amount
];
for it = 0 to $(vMeterRows)
let vMet=peek('MeterReference',$(it),'MetRefTemp');
trace $(it);
load *
resident [ReadingsTemp];
concatenate(ReadingsTemp)
load
MeterReference
,ReadingsID
,ReadingDateTime
,RptTime
,Value_Amount
resident [ENMATReadings]
where (MeterReference='$(vMet)');
next;
left join(ReadingsTemp)
load * Resident MetRefTemp;
Hi, it will be better if you leave the concatente row uncommented, just comment the rows I posted.
Maybe ReadingTemp is autoconcatenating with the ENMATReadings, to avoid that add 'NoConcatenate' to the instruction that initially creates the table:
[ReadingsTemp]:
NoConcatenate LOAD * INLINE [
Hi, I think it's caused by
load *
resident [ReadingsTemp];
Just remove that rows before the concatenating, this is adding what is already in table, causing duplicates.
Nope, still doubling. Commented the following out, and the output (proof that it's doubling) is below
Output
Hi, it will be better if you leave the concatente row uncommented, just comment the rows I posted.
Maybe ReadingTemp is autoconcatenating with the ENMATReadings, to avoid that add 'NoConcatenate' to the instruction that initially creates the table:
[ReadingsTemp]:
NoConcatenate LOAD * INLINE [