Page 1 of 1

CSV writer (overwrite row data)

Posted: Tue Nov 07, 2023 3:04 pm
by RGV250
Hi,
This is probably a very simple thing but I cannot figure out how to do it. I have created a test file to simulate data, I can create a CSV file and increment the rows and all is fine. I then tried to overwrite the same row but it just adds the new data to the next column on the same row.
Is it possible to do this.
I have attached the test file and the CSV file it creates
CSVTestRPI_1.fcfx
(12.13 KiB) Downloaded 826 times
.
test1.csv
(1.08 KiB) Downloaded 864 times
Regards,
Bob

Re: CSV writer (overwrite row data)

Posted: Wed Nov 08, 2023 11:25 am
by RGV250
Hi,
I did have a thought if this is not possible with the current commands if I could modify the "Next row" but that only seems possible with the professional version. Is it possible to view the code so I can create my own component or is this only possible in the professional version as well.
If it is possible can you let me know where the information is. I did find this
https://www.matrixtsl.com/wiki/index.ph ... _Component
but that is for an old version and also seems to only be for the professional version.

Regards,
Bob

Re: CSV writer (overwrite row data)

Posted: Wed Nov 08, 2023 2:57 pm
by medelec35
Hello.
One of the new features of v10, we have allowed most of the components to be open source.
You can download or view the source code, by selecting the component on the panel, right-click and select help.
Or you can right-click help from Component Libraries or component search.
You will need to change the GUID, otherwise when you do an update, your component will be overridden.
I mentioned how to do that in this post.
You should be able to do that with pro or non pro license.
Component creation can be found on the v10 Wiki

Re: CSV writer (overwrite row data)

Posted: Fri Nov 10, 2023 10:31 am
by BenR
Updating a value in a CSV is tricky, mainly as it means manipulating a file half way through. Inserting or deleting characters needs to be rippled through and written to all the sectors of the file and so it's not a trivial task.

One way is to read the contents of the file into memory and then open the file again, erasing the contents and re-writing the file with the new updated data. This will work for smaller files and is a trick I have used before.

I'll have a think and see if we can find a nice way to edit half way through a file in a way where all the complexity is taken care of for you, this should make overwriting a cell a lot easier.

Re: CSV writer (overwrite row data)

Posted: Fri Nov 10, 2023 12:27 pm
by mnfisher
One idea is to use fixed length data - say four hex digits - then a particular sample is always at a fixed position - this saves changing the file size if data is overwritten.

Re: CSV writer (overwrite row data)

Posted: Fri Nov 10, 2023 1:08 pm
by LeighM
... a trick used by the IBM AS/400 :lol:

Re: CSV writer (overwrite row data)

Posted: Wed Nov 15, 2023 11:26 am
by RGV250
Hi,
This may not be neccessary now, it was the only way (that I understood) that I could see of getting data from FC into a database.
Chipfryer has been doing a lot of work trying to help me with PHP GET function which seems to be a nice solution.

Regards,
Bob