I would like to add a header bar into the text file on top and first row. The next row onwards the variable data would be there. Could some one help me to write optoscript to insert header line when a new file is created. I have already Optoscript to insert the data but don’t know how to insert header line in the first row in the text file in FTP. The txt file can ne created in RAM or MicroSD card.
Welcome to the forums!
Could you share a screenshot of how you’re inserting the data?
If you are creating a communication handle to send the data to the text file, you should be able to transmit the header line after creating the file but before sending the data, perhaps in a separate script block. It just depends on how you’re filling up the file with data.
I am using the below sample file to log data using FTP
In this sample file, the data logs but don’t have opto script to create column header inside txt file.
Hence I would like to create column header in text file where data is being logged as CSV format.
You could add an if statement to check if the index is zero, and set an initial line before adding the rest of the data.
Here’s an example: