Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
varmekontrol
Creator
Creator

Peek not working as intenden when using it for consumption by date.

HI 

I am pulling the last of my hair out of my head because of this. 
Hope you can help me figure out what is wrong. 

I am creating a QVD file with this. 

Heat_meter_qvd:
LOAD Num(@1) as Cme_no, 
     Num(@2) as Meter_no, 
     date(@3, 'YYYY-MM-DD hh:mm') as Created,
     num(@8/1000) as Energy_wH,
     Num(@9) as Volume_m3, 
     Num(@10) as Volume_flow_m3H, 
     Num(@12) as Flow_temp_C, 
     Num(@13) as Return_temp_C,
     num(@12-@13) as Temp_diff_C

FROM
[D:\HeatMeter\*.csv]
(txt, codepage is 28591, no labels, delimiter is ';', msq, header is 1 lines where Date(@3)>=today()-7;

STORE  Heat_meter_qvd into "C:\Heat_meter.qvd" (qvd);
Drop Table Heat_meter_qvd;

From that QVD I am importing a table and calculating the peek from the previous date (Consumption) 
FYI - It has been working since I made it a couple of days ago, and now it just stopped and have 0 consumption. 

Heat_meter_temp_1:
LOAD Cme_no, 
     num(Meter_no,'00000000') as  Meter_no,
     Created,
     Energy_wH, 
     Volume_m3, 
     Volume_flow_m3H, 
     Flow_temp_C, 
     Return_temp_C, 
     Temp_diff_C
FROM
[C:\Heat_meter.qvd]
(qvd);

Heat_meter_temp_2: 
NoConcatenate
LOAD *,
	 peek('Energy_wH') as Energy_wH_peek,
	 num(((Energy_wH-peek('Energy_wH'))),'#####,00') as Energy_wH_consumption,
	 peek('Volume_m3') as Volume_m3_peek,
	 num(((Volume_m3-peek('Volume_m3'))),'#####,00') as Volume_m3_consumption	 
Resident Heat_meter_temp_1 order by Meter_no, Created;

Drop Field Energy_wH_peek, Volume_m3_peek;
Drop Table Heat_meter_temp_1;

Heat_meter:
NoConcatenate
Load *   	
Resident Heat_meter_temp_2 where Energy_wH_consumption>=0 and Volume_m3_consumption>=0;

Drop Table Heat_meter_temp_2;

My result is this. 

Cme_no Meter_no Created Energy_wH wH_consump Volume_m3 m3_consump 
120552186872766921-03-2019 00:004165301389,650
120552186872766921-03-2019 00:3041654 1389,67 
120552186872766921-03-2019 01:004165401389,69 
120552186872766921-03-2019 01:304165401389,71 
120552186872766921-03-2019 02:0041655 1389,73 
120552186872766921-03-2019 02:304165501389,76 
120552186872766921-03-2019 03:0041656 1389,78 
120552186872766921-03-2019 03:304165601389,8 
120552186872766921-03-2019 04:0041657 1389,82 
120552186872766921-03-2019 04:304165701389,84 
120552186872766921-03-2019 05:004165701389,86 
120552186872766921-03-2019 05:3041658 1389,88 
120552186872766921-03-2019 06:004165801389,91 
120552186872766921-03-2019 06:3041659 1389,93 
120552186872766921-03-2019 07:004165901389,95 
120552186872766921-03-2019 07:3041660 1389,98 
120552186872766921-03-2019 08:004166001389,99 
120552186872766921-03-2019 08:3041662 1390,04 
120552186872766921-03-2019 09:0041663 1390,06 
120552186872766921-03-2019 09:304166301390,08 
120552186872766921-03-2019 10:004166301390,1 

 

1 Solution

Accepted Solutions
sunny_talwar

Can you check if the attached looks good

View solution in original post

16 Replies
Silver563
Contributor
Contributor

You can see that each row has an associated date. This is in fact not a column, but instead a time index for value. As an index, there can be multiple values for one time myprepaidcenter, and values may be spaced evenly or unevenly across times.

sunny_talwar

So, you see null instead of a number?

image.png

varmekontrol
Creator
Creator
Author

@sunny_talwar 

It looks like that 0 is the only one it gets right.

When there should be consumption it is null 

image.png

sunny_talwar

It is weird that when the value matches the previous value, you see the script to be working, it is only when they don't match... you get a null....

Is there an if statement in your script when you create the new wH_consump field? Like If(Meter_no = Previous(Meter_no)... or something else? The reason I ask this is because I don't see any issue with your script unless there are things which you have no shared here....

varmekontrol
Creator
Creator
Author

Yes very strange. 
I am not using any if statement in the table or load script. 

More strange is that I just made a new table in the same app without changes anything and it works fine. 

image.png

But trying to use the consumption in a bar-chart is still only shows nullvalues. 

image.png

 

 

sunny_talwar

I wouldn't know what is going on unless I see it and able to run it. Do you think it is possible to share a sample?

varmekontrol
Creator
Creator
Author

No problem, just need to remove some personal data from it. 

But this should be enough for you to work with ( i hope) 🙂

Thx Sunny 

sunny_talwar

How is the CSV data corresponds to the data in your app? I was looking at HeatMeter folder and I am not sure what field corresponds to what?

varmekontrol
Creator
Creator
Author

Sorry for that Sunny
Was not sure how much you needed. 

Here is the csv data.