Hi, I'm trying to send data to a server via sftp in files called "Table_YYYY-MM-DD.dat". Every file containing records between midnight and 23:59:59.
To achieve this, I used Table.Timestamp(5, m), with m the number of records between two transmissions.
The result is records between midnight and 23:59:59 only with Slow Table, the first. The other two table, Stat and Sonic files have record between 00:00:07.35 and 23:59:40.5 or something similar.
I also tried faster scan times, such as 30 seconds, but nothing changed.
How can I send data as frequently as possible, change the name at midnight, and correctly separate the stored records? Thanks
'CR6 Series
'Double sonic via RS232, double etm-30, sftp send and mail average notification
'ETM every 1 sec
'Sonic every 50 msec
'Average every 30 min sent by email every 6 hr
'All raw data sent via SFTP
'Mail
Const _EMAIL_SUBJECT = "Six hour average"
Const _EMAIL_TO_ADDRESS = ""
Public email_message As String * 100
Public email_relay_server_response As String * 100
Public email_relay_results_human_readable As String * 40
Public email_tx_success
Public avgName As String, previousAvgName As String
Public mailFlag As Boolean
'FTP parameter strings (as constants), Message String & Result Variable
Public FTPResult, FTPResult2, FTPResult3
Const IPAddress=""
Const UserName=""
Const Password=""
Public sftpFlag As Boolean
Public date_slow As String * 15
Public date_stat As String * 15
Public date_sonic As String * 15
'Serial COM RS232
Const STX=CHR(2) 'ASCII start-of-text
Const ETX=CHR(3) 'ASCII end-of-text
Public row2 As String * 50
Public n2 As Long
'Declare Public Variables
Public u_1
Public v_1
Public w_1
Public Ts_1
Public u_2
Public v_2
Public w_2
Public Ts_2
Public AirTC1
Public RH1
Public AirTC2
Public RH2
Public BattV
Public PTemp_C
'Public BP_mbar
Units u_1=m/s
Units v_1=m/s
Units w_1=m/s
Units Ts_1=C
Units u_2=m/s
Units v_2=m/s
Units w_2=m/s
Units Ts_2=C
Units AirTC1=Deg C
Units RH1=%
Units AirTC2=Deg C
Units RH2=%
Units BattV=Volts
'Units BP_mbar=hPa
'Define slow Data Tables
DataTable(Slow,True,-1)
DataInterval(0,1,Sec,0)
TableFile ("CRD:"&Status.SerialNumber(1,1)&"_slow_data_",64,-1,0,1,Day,0,0)
Sample(1,AirTC1,FP2)
Sample(1,RH1,FP2)
Sample(1,AirTC2,FP2)
Sample(1,RH2,FP2)
EndTable
DataTable(Stat,True,-1)
DataInterval(0,1,Sec,0)
TableFile ("CRD:"&Status.SerialNumber(1,1)&"_status_",64,-1,0,1,Day,0,0)
Minimum(1,BattV,FP2,False,False)
Average(1,PTemp_C,FP2,False)
EndTable
'Define Data Tables
DataTable (Sonic,True,-1)
DataInterval(0,50,mSec,0)
TableFile ("CRD:"&Status.SerialNumber(1,1)&"_sonic_data_",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, u_2,FP2)
Sample(1, v_2,FP2)
Sample(1, w_2,FP2)
Sample(1, Ts_2,FP2)
EndTable
DataTable (Avg,True,-1)
DataInterval (0,30,Min,0) 'aggiungo riga alla tabella ogni 30 min
'crea file nuovo ogni 6 ore = intervallo invio mail), tiene solo gli ultimi 4 file di medie, e invio per mail quello appena salvato
TableFile("CRD:avg",64,5,0,6,Hr,0,avgName)
Average (1,AirTC1,FP2,False)
Average (1,RH1,FP2,False)
Average (1,AirTC2,FP2,False)
Average (1,RH2,FP2,False)
Average(1, u_1,FP2,False)
Average(1, v_1,FP2,False)
Average(1, w_1,FP2,False)
Average(1, Ts_1,FP2,False)
Average(1, u_2,FP2,False)
Average(1, v_2,FP2,False)
Average(1, w_2,FP2,False)
Average(1, Ts_2,FP2,False)
Minimum(1,BattV,FP2,False,False)
EndTable
'Main Program
BeginProg
mailFlag = True 'true invia mail
sftpFlag = True
SerialOpen(ComC3,9600,3,0,512,0)
Scan (50,mSec,1200,0)
VoltSe(u_1,1,mV5000,U1,False,200,15000,0.008,-20) '-20)
VoltSe(v_1,1,mV5000,U2,False,200,15000,0.008,-20) '-20)
VoltSe(w_1,1,mV5000,U3,False,200,15000,0.008,-20) '-20)
VoltSe(Ts_1,1,mV5000,U4,False,200,15000,0.022,-40)
SerialInRecord (ComC3,row2,2,0,3,n2,01) '2 and 3 ascii char or &H02 and &H0D0A
If n2 = 39 Then
u_2 = Mid(row2,3,7)
v_2 = Mid(row2,11,7)
w_2 = Mid(row2,19,7)
Ts_2 = Mid(row2,29,7)
EndIf
CallTable Sonic
NextScan
SlowSequence
Scan(1,Sec,1,0)
'Default CR6 Datalogger Battery Voltage measurement 'BattV'
Battery(BattV)
VoltSe(AirTC1,1,mV1000,U10,False,0,15000,0.1,-40)
VoltSe(RH1,1,mV1000,U9,False,0,15000,0.1,0)
If RH1>100 AND RH1<103 Then RH1=100
VoltSe(AirTC2,1,mV1000,U12,False,0,15000,0.1,-40)
VoltSe(RH2,1,mV1000,U11,False,0,15000,0.1,0)
If RH2>100 AND RH2<103 Then RH2=100
CallTable Slow
CallTable Stat
CallTable Avg
NextScan
SlowSequence
Scan(30,Min,3,0)
'Send to server
If sftpFlag Then
date_slow = Left(Slow.Timestamp(5,1800),10) '1 * 60 * 30 measure ago
date_stat = Left(Stat.Timestamp(5,1800),10) '1 * 60 * 30 measure ago
date_sonic = Left(Sonic.Timestamp(5,36000),10) '20 * 60 * 30 measure ago
FTPResult=FTPClient(IPAddress,UserName,Password,"Slow","Slow_" & date_slow & ".dat",28,0,0,Min,-1008)
FTPResult2=FTPClient(IPAddress,UserName,Password,"Stat","Stat_" & date_stat & ".dat",28,0,0,Min,-1008)
FTPResult3=FTPClient(IPAddress,UserName,Password,"Sonic","Sonic_" & date_sonic & ".dat",28,0,0,Min,-1008)
EndIf
'Send email
If avgName <> previousAvgName AND mailFlag Then 'if new file avg saved
previousAvgName = avgName
email_message = email_message & "Datalogger station " & Status.StationName & ". "
email_message = email_message & "Datalogger time is " & Public.Timestamp(4,1)
'1st attempt
email_tx_success = EmailRelay (_EMAIL_TO_ADDRESS,_EMAIL_SUBJECT,email_message,email_relay_server_response,avgName)
'If EmailRelay was not successful, lets try one more time.
If email_tx_success <> -1 Then
'2nd attempt
email_tx_success = EmailRelay (_EMAIL_TO_ADDRESS,_EMAIL_SUBJECT,email_message,email_relay_server_response,avgName)
EndIf
'Human readable error messages
Select Case email_tx_success
Case -1
email_relay_results_human_readable = "EmailRelay received msg OK!"
Case 0
email_relay_results_human_readable = "Conn to EmailRelay failed"
Case -2
email_relay_results_human_readable = "lack of records or not enough time"
Case -3
email_relay_results_human_readable = "EmailRelay OK, error in communication."
EndSelect
EndIf
NextScan
EndProg
The easiest way is usually the optional parameters in the FTPClient() instruction. There is a technical paper on the topic:
https://s.campbellsci.com/documents/us/technical-papers/ftp-streaming.pdf
Sorry, but I don't understand how can I send data frequently (every 10-30 minutes) and change the date in the file name to match the data inside.
With the optional parameters of FTPClient(), it seems to me that I can only send one file per day at midnight, with an incremental number appended.
Thanks
Update, with three different slowsequence the fiilename changes correctly and the file starts with 00:00:00 and end with 23:59:59.95 as I want.
But still remains a bug: sometimes at HH:30:00 the file on server looks like (look at datetime column):
"2025-10-23 01:31:09.85",919328,0.097,0.144,0.247,23.98,-19.99,-19.94,-19.93,-31.74 "2025-10-23 01:31:09.9",919329,-0.03,0.137,0.254,23.99,-19.99,-19.94,-19.93,-31.7 "2025-10-23 01:31:09.95",919330,-0.067,0.144,0.182,23.94,-19"2025-10-23 01:30:00",917931,-0.044,0.105,0.114,23.96,-20,-19.95,-19.93,-31.68 "2025-10-23 01:30:00.05",917932,-0.04,0.104,0.063,23.93,-20,-19.94,-19.93,-31.65 "2025-10-23 01:30:00.1",917933,-0.123,0.104,0.061,23.94,-20,-19.95,-19.93,-31.68 "2025-10-23 01:30:00.15",917934,0.088,0.103,0.048,23.91,-20,-19.95,-19.93,-31.67 "2025-10-23 01:30:00.2",917935,-0.128,0.103,0.063,23.99,-20,-19.95,-19.93,-31.67 "2025-10-23 01:30:00.25",917936,-0.124,0.102,0.065,23.93,-19.99,-19.95,-19.94,-31.68
or
"2025-10-23 20:54:01.7",114807,0.234,0.217,0.473,23.86,0.02,0.193,0.241,25.09 "2025-10-23 20:54:01.75",114808,0.266,0.209,0.159,23.84,0.025,0.187,0.244,25.09 "2025-10-23 20:54:01.8",114809,0.15,0.183,0.154,23.78,0.026,0.185,0.247,25.1 "2025-10-23 20:54:01.85",114810,0.093,0.178,0.103,23.86,0"2025-10-23 20:30:00",85973,0.216,0.182,0.161,23.81,0.024,0.193,0.245,25.09 "2025-10-23 20:30:00.05",85974,0.394,0.18,0.168,23.83,0.026,0.189,0.24,25.09 "2025-10-23 20:30:00.1",85975,0.062,0.178,-0.032,23.85,0.018,0.193,0.239,25.09 "2025-10-23 20:30:00.15",85976,-0.027,0.199,0.476,23.82,0.025,0.187,0.244,25.09 "2025-10-23 20:30:00.2",85977,0.158,0.224,0.127,23.81,0.027,0.193,0.244,25.09 "2025-10-23 20:30:00.25",85978,0.36,0.196,0.143,23.82,0.019,0.192,0.25,25.08
as if the current streaming were interrupted and restarted from the beginning of 30 min, the file then continues as it should, with only the discontinuity that I posted. Thanks, I really appreciate your help.
The programm:
'CR6 Series
'Mail
Const _EMAIL_SUBJECT = "Six hour average"
Const _EMAIL_TO_ADDRESS = ""
Public email_message As String * 100
Public email_relay_server_response As String * 100
Public email_relay_results_human_readable As String * 40
Public email_tx_success
Public avgName As String, previousAvgName As String
Public email_flag As Boolean
Public sftp_flag As Boolean
'FTP parameter strings (as constants), Message String & Result Variable
Public FTPResult, FTPResult2, FTPResult3
Const IPAddress=""
Const UserName=""
Const Password=""
Public date_slow As String * 15
Public date_stat As String * 15
Public date_sonic As String * 15
'Declare Public Variables
Public u_1
Public v_1
Public w_1
Public Ts_1
Public u_2
Public v_2
Public w_2
Public Ts_2
Public AirTC1
Public RH1
Public AirTC2
Public RH2
Public BattV
Public PTemp_C
'Public BP_mbar
'Define slow Data Tables
DataTable(Slow,True,-1)
DataInterval(0,1,Sec,0)
TableFile ("CRD:"&Status.SerialNumber(1,1)&"_slow_data_",64,-1,0,1,Day,0,0)
Sample(1,AirTC1,FP2)
Sample(1,RH1,FP2)
Sample(1,AirTC2,FP2)
Sample(1,RH2,FP2)
' Sample(1,BP_mbar,FP2)
EndTable
DataTable(Stat,True,-1)
DataInterval(0,1,Sec,0)
TableFile ("CRD:"&Status.SerialNumber(1,1)&"_status_",64,-1,0,1,Day,0,0)
Minimum(1,BattV,FP2,False,False)
Average(1,PTemp_C,FP2,False)
EndTable
'Define Data Tables
DataTable (Sonic,True,-1)
DataInterval(0,50,mSec,0)
TableFile ("CRD:"&Status.SerialNumber(1,1)&"_sonic_data_",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, u_2,FP2)
Sample(1, v_2,FP2)
Sample(1, w_2,FP2)
Sample(1, Ts_2,FP2)
EndTable
DataTable (Avg,True,-1)
DataInterval (0,30,Min,0) 'aggiungo riga alla tabella ogni 30 min
'crea file nuovo ogni 6 ore = intervallo invio mail), tiene solo gli ultimi 4 file di medie, e invio per mail quello appena salvato
TableFile("CRD:avg",64,5,0,6,Hr,0,avgName)
Average (1,AirTC1,FP2,False)
Average (1,RH1,FP2,False)
Average (1,AirTC2,FP2,False)
Average (1,RH2,FP2,False)
Average(1, u_1,FP2,False)
Average(1, v_1,FP2,False)
Average(1, w_1,FP2,False)
Average(1, Ts_1,FP2,False)
Average(1, u_2,FP2,False)
Average(1, v_2,FP2,False)
Average(1, w_2,FP2,False)
Average(1, Ts_2,FP2,False)
Minimum(1,BattV,FP2,False,False)
EndTable
'Main Program
BeginProg
email_flag = True 'true invia mail
sftp_flag = True
Scan (50,mSec,1200,0)
VoltSe(u_1,1,mV5000,U1,False,200,15000,0.02,-50) '-20)
VoltSe(v_1,1,mV5000,U2,False,200,15000,0.02,-50) '-20)
VoltSe(w_1,1,mV5000,U3,False,200,15000,0.02,-50) '-20)
VoltSe(Ts_1,1,mV5000,U4,False,200,15000,0.022,-40)
VoltSe(u_2,1,mV5000,U5,False,200,15000,0.02,-50) '-20)
VoltSe(v_2,1,mV5000,U6,False,200,15000,0.02,-50) '-20)
VoltSe(w_2,1,mV5000,U7,False,200,15000,0.02,-50) '-20)
VoltSe(Ts_2,1,mV5000,U8,False,200,15000,0.022,-40)
CallTable Sonic
NextScan
SlowSequence
Scan(1,Sec,10,0)
'Default CR6 Datalogger Battery Voltage measurement 'BattV'
Battery(BattV)
VoltSe(AirTC1,1,mV1000,U10,False,0,15000,0.1,-40)
VoltSe(RH1,1,mV1000,U9,False,0,15000,0.1,0)
If RH1>100 AND RH1<103 Then RH1=100
VoltSe(AirTC2,1,mV1000,U12,False,0,15000,0.1,-40)
VoltSe(RH2,1,mV1000,U11,False,0,15000,0.1,0)
If RH2>100 AND RH2<103 Then RH2=100
CallTable Slow
CallTable Stat
CallTable Avg
NextScan
EndSequence
SlowSequence
Scan(30,Min,10,0)
If sftp_flag Then
date_sonic = Mid(Sonic.Timestamp(5,12000),1,10)
FTPResult3=FTPClient(IPAddress,UserName,Password,"Sonic","Sonic_" & date_sonic & ".dat",28,0,0,Min,-1008)
EndIf
NextScan
EndSequence
SlowSequence
Scan(30,Min,10,0)
If sftp_flag Then
date_slow = Mid(Slow.Timestamp(5,600),1,10)
FTPResult=FTPClient(IPAddress,UserName,Password,"Slow","Slow_" & date_slow & ".dat",28,0,0,Min,-1008)
EndIf
NextScan
EndSequence
SlowSequence
Scan(30,Min,10,0)
'Send to server
If sftp_flag Then
date_stat = Mid(Stat.Timestamp(5,600),1,10)
FTPResult2=FTPClient(IPAddress,UserName,Password,"Stat","Stat_" & date_stat & ".dat",28,0,0,Min,-1008)
EndIf
'Send email
If avgName <> previousAvgName AND email_flag Then 'if new file avg saved
previousAvgName = avgName
'email stuff
EndIf
NextScan
EndSequence
EndProg
Update, with three different slowsequence the fiilename changes correctly and the file starts with 00:00:00 and end with 23:59:59.95 as I want.
But still remains a bug: sometimes at HH:30:00 the file on server looks like (look at datetime column):
"2025-10-23 01:31:09.85",919328,0.097,0.144,0.247,23.98,-19.99,-19.94,-19.93,-31.74 "2025-10-23 01:31:09.9",919329,-0.03,0.137,0.254,23.99,-19.99,-19.94,-19.93,-31.7 "2025-10-23 01:31:09.95",919330,-0.067,0.144,0.182,23.94,-19"2025-10-23 01:30:00",917931,-0.044,0.105,0.114,23.96,-20,-19.95,-19.93,-31.68 "2025-10-23 01:30:00.05",917932,-0.04,0.104,0.063,23.93,-20,-19.94,-19.93,-31.65 "2025-10-23 01:30:00.1",917933,-0.123,0.104,0.061,23.94,-20,-19.95,-19.93,-31.68 "2025-10-23 01:30:00.15",917934,0.088,0.103,0.048,23.91,-20,-19.95,-19.93,-31.67 "2025-10-23 01:30:00.2",917935,-0.128,0.103,0.063,23.99,-20,-19.95,-19.93,-31.67 "2025-10-23 01:30:00.25",917936,-0.124,0.102,0.065,23.93,-19.99,-19.95,-19.94,-31.68
or
"2025-10-23 20:54:01.7",114807,0.234,0.217,0.473,23.86,0.02,0.193,0.241,25.09 "2025-10-23 20:54:01.75",114808,0.266,0.209,0.159,23.84,0.025,0.187,0.244,25.09 "2025-10-23 20:54:01.8",114809,0.15,0.183,0.154,23.78,0.026,0.185,0.247,25.1 "2025-10-23 20:54:01.85",114810,0.093,0.178,0.103,23.86,0"2025-10-23 20:30:00",85973,0.216,0.182,0.161,23.81,0.024,0.193,0.245,25.09 "2025-10-23 20:30:00.05",85974,0.394,0.18,0.168,23.83,0.026,0.189,0.24,25.09 "2025-10-23 20:30:00.1",85975,0.062,0.178,-0.032,23.85,0.018,0.193,0.239,25.09 "2025-10-23 20:30:00.15",85976,-0.027,0.199,0.476,23.82,0.025,0.187,0.244,25.09 "2025-10-23 20:30:00.2",85977,0.158,0.224,0.127,23.81,0.027,0.193,0.244,25.09 "2025-10-23 20:30:00.25",85978,0.36,0.196,0.143,23.82,0.019,0.192,0.25,25.08
as if the current streaming were interrupted and restarted from the beginning of 30 min, the file then continues as it should, with only the discontinuity that I posted. Thanks, I really appreciate your help.
The programm:
'CR6 Series
'Mail
Const _EMAIL_SUBJECT = "Six hour average"
Const _EMAIL_TO_ADDRESS = ""
Public email_message As String * 100
Public email_relay_server_response As String * 100
Public email_relay_results_human_readable As String * 40
Public email_tx_success
Public avgName As String, previousAvgName As String
Public email_flag As Boolean
Public sftp_flag As Boolean
'FTP parameter strings (as constants), Message String & Result Variable
Public FTPResult, FTPResult2, FTPResult3
Const IPAddress=""
Const UserName=""
Const Password=""
Public date_slow As String * 15
Public date_stat As String * 15
Public date_sonic As String * 15
'Declare Public Variables
Public u_1
Public v_1
Public w_1
Public Ts_1
Public u_2
Public v_2
Public w_2
Public Ts_2
Public AirTC1
Public RH1
Public AirTC2
Public RH2
Public BattV
Public PTemp_C
'Public BP_mbar
'Define slow Data Tables
DataTable(Slow,True,-1)
DataInterval(0,1,Sec,0)
TableFile ("CRD:"&Status.SerialNumber(1,1)&"_slow_data_",64,-1,0,1,Day,0,0)
Sample(1,AirTC1,FP2)
Sample(1,RH1,FP2)
Sample(1,AirTC2,FP2)
Sample(1,RH2,FP2)
' Sample(1,BP_mbar,FP2)
EndTable
DataTable(Stat,True,-1)
DataInterval(0,1,Sec,0)
TableFile ("CRD:"&Status.SerialNumber(1,1)&"_status_",64,-1,0,1,Day,0,0)
Minimum(1,BattV,FP2,False,False)
Average(1,PTemp_C,FP2,False)
EndTable
'Define Data Tables
DataTable (Sonic,True,-1)
DataInterval(0,50,mSec,0)
TableFile ("CRD:"&Status.SerialNumber(1,1)&"_sonic_data_",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, u_2,FP2)
Sample(1, v_2,FP2)
Sample(1, w_2,FP2)
Sample(1, Ts_2,FP2)
EndTable
DataTable (Avg,True,-1)
DataInterval (0,30,Min,0) 'aggiungo riga alla tabella ogni 30 min
'crea file nuovo ogni 6 ore = intervallo invio mail), tiene solo gli ultimi 4 file di medie, e invio per mail quello appena salvato
TableFile("CRD:avg",64,5,0,6,Hr,0,avgName)
Average (1,AirTC1,FP2,False)
Average (1,RH1,FP2,False)
Average (1,AirTC2,FP2,False)
Average (1,RH2,FP2,False)
Average(1, u_1,FP2,False)
Average(1, v_1,FP2,False)
Average(1, w_1,FP2,False)
Average(1, Ts_1,FP2,False)
Average(1, u_2,FP2,False)
Average(1, v_2,FP2,False)
Average(1, w_2,FP2,False)
Average(1, Ts_2,FP2,False)
Minimum(1,BattV,FP2,False,False)
EndTable
'Main Program
BeginProg
email_flag = True 'true invia mail
sftp_flag = True
Scan (50,mSec,1200,0)
VoltSe(u_1,1,mV5000,U1,False,200,15000,0.02,-50) '-20)
VoltSe(v_1,1,mV5000,U2,False,200,15000,0.02,-50) '-20)
VoltSe(w_1,1,mV5000,U3,False,200,15000,0.02,-50) '-20)
VoltSe(Ts_1,1,mV5000,U4,False,200,15000,0.022,-40)
VoltSe(u_2,1,mV5000,U5,False,200,15000,0.02,-50) '-20)
VoltSe(v_2,1,mV5000,U6,False,200,15000,0.02,-50) '-20)
VoltSe(w_2,1,mV5000,U7,False,200,15000,0.02,-50) '-20)
VoltSe(Ts_2,1,mV5000,U8,False,200,15000,0.022,-40)
CallTable Sonic
NextScan
SlowSequence
Scan(1,Sec,10,0)
'Default CR6 Datalogger Battery Voltage measurement 'BattV'
Battery(BattV)
VoltSe(AirTC1,1,mV1000,U10,False,0,15000,0.1,-40)
VoltSe(RH1,1,mV1000,U9,False,0,15000,0.1,0)
If RH1>100 AND RH1<103 Then RH1=100
VoltSe(AirTC2,1,mV1000,U12,False,0,15000,0.1,-40)
VoltSe(RH2,1,mV1000,U11,False,0,15000,0.1,0)
If RH2>100 AND RH2<103 Then RH2=100
CallTable Slow
CallTable Stat
CallTable Avg
NextScan
EndSequence
SlowSequence
Scan(30,Min,10,0)
If sftp_flag Then
date_sonic = Mid(Sonic.Timestamp(5,12000),1,10)
FTPResult3=FTPClient(IPAddress,UserName,Password,"Sonic","Sonic_" & date_sonic & ".dat",28,0,0,Min,-1008)
EndIf
NextScan
EndSequence
SlowSequence
Scan(30,Min,10,0)
If sftp_flag Then
date_slow = Mid(Slow.Timestamp(5,600),1,10)
FTPResult=FTPClient(IPAddress,UserName,Password,"Slow","Slow_" & date_slow & ".dat",28,0,0,Min,-1008)
EndIf
NextScan
EndSequence
SlowSequence
Scan(30,Min,10,0)
'Send to server
If sftp_flag Then
date_stat = Mid(Stat.Timestamp(5,600),1,10)
FTPResult2=FTPClient(IPAddress,UserName,Password,"Stat","Stat_" & date_stat & ".dat",28,0,0,Min,-1008)
EndIf
'Send email
If avgName <> previousAvgName AND email_flag Then 'if new file avg saved
previousAvgName = avgName
'email stuff
EndIf
NextScan
EndSequence
EndProg