NetTalk Central
NetTalk Web Server => Web Server - Ask For Help => Topic started by: Richard I on February 01, 2024, 02:12:31 AM
-
Hi,
Im sequentially copying tps records to a CSV file by date
ExpCSV:Label1 = LOG:NAME
ExpCSV:Label2 = loclogin
ExpCSV:Label3 = FORMAT(LOG:Datein,@D6)
ExpCSV:Label4 = FORMAT(LOG:timeIn,@T4)
I need the first row to have the name of the corresponding column ie Name ID Datein TimeIn etc
?? How to please.
Thanks
Richard
NT 14.16
-
use basic driver
FIRSTROWHEADER
DRIVER('BASIC', '/FIRSTROWHEADER=[ON|OFF]' )
[ Buffers" = ] SEND(file, '/FIRSTROWHEADER [ = ON|OFF]' )
This indicates if the first row of the file contains the labels of the columns.
By default this switch is off. If turned on, then CREATE(file) will add a line containing the labels of the fields separated by the comma character (as specified by the COMMA switch or ','), further the first line will always be skipped when reading from the file.
-
Hi Richard,
If you have StringTheory then it is easy and fast.
IF ~EXISTS('yourfilename.CSV')
ST.SetValue('Name,Login,Datein,TimeIn'&'<13,10>')
ST.SaveFile('yourfilename.CSV',FALSE)
ST.SetValue(ExpCSV:Label1&','&ExpCSV:Label2&','&ExpCSV:Label3&','&ExpCSV:Label4&'<13,10>')
ST.SaveFile('yourfilename.CSV',TRUE)
ELSE
ST.SetValue(ExpCSV:Label1&','&ExpCSV:Label2&','&ExpCSV:Label3&','&ExpCSV:Label4&'<13,10>')
ST.SaveFile('yourfilename.CSV',TRUE)
END
Not tested and there might be a better and faster way.
Regards
Johan de Klerk
-
Thanks guys, but too easy with-
First time through before gathering data, but after initialisation
SET(ExportCSV)
ExpCSV:Label1 = 'Employee Name'
ExpCSV:Label2 = 'Payroll ID'
ExpCSV:Label3 = 'Date In'
ExportCSV.Insert
Cheers
Richard