Hi, I close tablefile at midnight and send via SFTP streaming every hour. (CR6.14.4.0 CR6-WIFI.05.03)
On the server, only the file sent at midnight contains only one row:
Sonic_2025-12-16_00-00-00.dat on server:
"TIMESTAMP","RECORD","u_1","v_1","w_1","Ts_1","SS_1","ChkSumF_1","u_2","v_2","w_2","Ts_2","SS_2","ChkSumF_2" "2025-12-16 00:00:00.05",752374,0.014,0.013,0.003,18.18,"00",-1,0.028,-0.006,0.027,17.69,"00",-1
instead of data between 23:00:00.05 and 00:00:00.00 (72000 row). I think it's because the file closes at midnight on the SD card.
How can I resolve? I tried a Scan(1, Hr) and a Scan(30, Sec) with the same results.
Thanks
Code:
DataTable (Sonic,True,-1)
DataInterval(0,50,mSec,0)
TableFile ("CRD:"&Status.SerialNumber(1,1)&"_sonic_",64,-1,0,1,Day,0,0)
Sample(1, u_1,FP2)
Sample(1, v_1,FP2)
Sample(1, w_1,FP2)
Sample(1, Ts_1,FP2)
Sample(1, SS_1, String)
Sample(1, ChkSumF_1,Boolean)
Sample(1, u_2,FP2)
Sample(1, v_2,FP2)
Sample(1, w_2,FP2)
Sample(1, Ts_2,FP2)
Sample(1, SS_2, String)
Sample(1, ChkSumF_2,Boolean)
EndTable
SlowSequence
Scan (1,Hr,10,0)
FTPResult3=FTPClient(IPAddress,UserName,Password,"Sonic", serialN&"/Sonic_YYYY-MM-DD_HH-MM-SS.dat",20,0,1,Hr,-1008)
FTPResult=FTPClient(IPAddress,UserName,Password,"Slow", serialN&"/Slow_YYYY-MM-DD_HH-MM-SS.dat",20,0,1,Hr,-1008)
FTPResult2=FTPClient(IPAddress,UserName,Password,"Stat", serialN & "/Stat_YYYY-MM-DD_HH-MM-SS.dat",20,0,1,Hr,-1008)
NextScan
EndSequence
This same question came up a few weeks ago. Because the slow sequence generally lags behind the main scan, TableFile had moved on to the new file before the FTPClient happened. You want to send the previous file, not the new file.
Use variables in the last two parameters in TableFile. They are OutStat and LastFileName. OutStat is true for when scan when the file closes.
Within the main scan, after CallTable, watch the boolean variable and copy the string with the name of the file to send. You can then use that as the source in FTPClient within the slow sequence.
If OutStat Then
FileToSend = LastFileName
SendFile = True
EndIf