From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how to read/write one csv file in multi-computer or read/write one csv file in same computer

Solved!
Go to solution

Dear

Dear All I want to put a csv file on a server.and multi-computer (12 ) to read/write the csv file. I find that the 12 computer all can read/write the csv file at one time point. thus can't save correct data ,. I have a confuse that why 12 computer can simultaneously read/write the csv file. if execut 3 program in one computer,the 3 program also can read/write the cav file simultaneously. please help. god
0 Kudos
Message 1 of 11
(4,994 Views)

Just as a side note:

in your case structure, in case "0" and "7" you use "Read/Write spreadsheet file" reopening for a second time the same file, since the reference has not been closed yet.

 

Marco

0 Kudos
Message 2 of 11
(4,986 Views)
Solution
Accepted by topic author hoover95

Hi,

 

safest approach: each executable/PC handles it's own data file. You will combine them later on while data analysis…

 

Next approach: your software opens the data files with EXCLUSIVE access rights. (The first accessor wins.) All other executables/PCs will have to wait for the first one to finish…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 3 of 11
(4,985 Views)

I would make a VI that handles the interaction of the file.  That VI alone can touch the file directly.  All of the other computers will have to talk to that VI through TCP/IP or some other network setup in order to read/write the data.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 4 of 11
(4,975 Views)

I would use a table in a database and append data there.

 

 

Marco

0 Kudos
Message 5 of 11
(4,967 Views)

@hoover95 wrote:

Dear

Dear All I want to put a csv file on a server.and multi-computer (12 ) to read/write the csv file. I find that the 12 computer all can read/write the csv file at one time point. thus can't save correct data ,. I have a confuse that why 12 computer can simultaneously read/write the csv file. if execut 3 program in one computer,the 3 program also can read/write the cav file simultaneously. please help. god

How reliable is your network?

What happens if connection is lost and data is not saved?

 

I would save the file locally and copy to a designated directory on the server.

Have a separate program concatenate the data into one file if necessary.

0 Kudos
Message 6 of 11
(4,960 Views)

MarcoMauri 已写:

Just as a side note:

in your case structure, in case "0" and "7" you use "Read/Write spreadsheet file" reopening for a second time the same file, since the reference has not been closed yet.

 

Marco


thanks for you help;

 

When multi computer read/write same csv file in the same server.you said that reopening for a second time the same file, since the reference has not been closed yet.

if have other method to resolve the problem.

 

thanks.

 

0 Kudos
Message 7 of 11
(4,911 Views)

GerdW 已写:

Hi,

 

safest approach: each executable/PC handles it's own data file. You will combine them later on while data analysis…

 

Next approach: your software opens the data files with EXCLUSIVE access rights. (The first accessor wins.) All other executables/PCs will have to wait for the first one to finish…


Thanks for you kindly reply

I want to adopt you ''Next approach' that you suggested.but i don't how to realize the software opens the data files with EXCLUSIVE access rights. and All other executables/PCs will have to wait for the first one to finish .Can you give me a hint.I'll appreciate heartly.

 

Thanks.

0 Kudos
Message 8 of 11
(4,903 Views)

I would do what crossrulz suggested. You can collect all the error messages using TCP/IP, push them in a queue and periodically save them to a file.

Also, you don't need to read every time the file and override it. You can just wire TRUE to 'append to file?' terminal of the 'Write To Spreadsheet File' and add rows at the end of the file.

And if you wire through the 'path' wire, you don't need the flat sequence structure at all.

 

 

0 Kudos
Message 9 of 11
(4,881 Views)
Solution
Accepted by topic author hoover95

Hi!

An other option could be to create a lock-file.

 

The first application writing to the file creates the lock-file.

If a lock-file is present, other applications will wait until it is removed before writing to the file.

 

Best regards,

Marco

 

 

0 Kudos
Message 10 of 11
(4,824 Views)