CSV writer (overwrite row data)

For general Flowcode discussion that does not belong in the other sections.
Post Reply
RGV250
Posts: 340
http://meble-kuchenne.info.pl
Joined: Sat Mar 19, 2022 4:53 pm
Has thanked: 34 times
Been thanked: 36 times

CSV writer (overwrite row data)

Post 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

RGV250
Posts: 340
Joined: Sat Mar 19, 2022 4:53 pm
Has thanked: 34 times
Been thanked: 36 times

Re: CSV writer (overwrite row data)

Post 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

medelec35
Matrix Staff
Posts: 2086
Joined: Wed Dec 02, 2020 11:07 pm
Has thanked: 644 times
Been thanked: 702 times

Re: CSV writer (overwrite row data)

Post 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
Martin

BenR
Matrix Staff
Posts: 1952
Joined: Mon Dec 07, 2020 10:06 am
Has thanked: 510 times
Been thanked: 698 times

Re: CSV writer (overwrite row data)

Post 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.

mnfisher
Valued Contributor
Posts: 1630
Joined: Wed Dec 09, 2020 9:37 pm
Has thanked: 142 times
Been thanked: 761 times

Re: CSV writer (overwrite row data)

Post 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.

LeighM
Valued Contributor
Posts: 489
Joined: Mon Dec 07, 2020 1:00 pm
Has thanked: 83 times
Been thanked: 262 times

Re: CSV writer (overwrite row data)

Post by LeighM »

... a trick used by the IBM AS/400 :lol:

RGV250
Posts: 340
Joined: Sat Mar 19, 2022 4:53 pm
Has thanked: 34 times
Been thanked: 36 times

Re: CSV writer (overwrite row data)

Post 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

Post Reply