LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Locked files

I have a LabView 8.6 application that writes to a .csv file on our network.  The .vi opens the file, writes  data then closes the file.  This repeats about every 5 minutes.  The amount of data we write is very small, only a few numbers and the time/date so the file should only be open for far less than a second.  The problem is that another application (not LabView) needs to access that file and do something with that data.  When that application tries to open the file it gets a network error such as "file being modified by another user"  even though labView has closed the file.  If I change the file location to the local drive, not the network, then there is no problem opening the file.  Our network tech thinks the problem has to do with optimistic/pessimistic locks in the network system.  When I close the labview application the file is available with no problem.  Is there something in LabView such as permissions or semaphore I can put in place to fix this?  The operating system is XP.

 

Thanks,

Glen

0 Kudos
Message 1 of 7
(3,374 Views)

Hi Glen,

 

How are you writing to the file? What VI are you using?

 

And when you say 'close LabVIEW', do you mean close that specific VI, stop the VI, or close LabVIEW completely?

Jeff | LabVIEW Software Engineer
0 Kudos
Message 2 of 7
(3,334 Views)

Hi Jeff,

 

The subVI is attached.  It's a open/create/replace file, a set file position to move to the end of the file and a format into file and close.  The subVI works file.  It's just that the data file I write to is not available for other applications to read until I close LabView completely.

 

Thanks for looking at this,

 

Glen

0 Kudos
Message 3 of 7
(3,321 Views)

This problem may arise when your .csv file is being accessed continuously by LabVIEW, even though it is writing data after 5 minutes. I suggest you create a timer of 5 minutes which would dynamically call the .vi file(which writes to the .csv file on the network ) each time after the timer resets and then close the reference after the writing.

Hopefully this would solve the problem.

 

-Parag D

-FraggerFox!
Certified LabVIEW Architect, Certified TestStand Developer
"What you think today is what you live tomorrow"
0 Kudos
Message 4 of 7
(3,317 Views)
The five minute number is just a rough estimate and varies widely so I don't think the timer will be the best solution.  Can I just call the FileSave.vi dynamically when the main program.vi need it then close the reference?
0 Kudos
Message 5 of 7
(3,307 Views)
Yes, you can. If you are using a state machine, you can create one array containing state names and boolean array as input to search 1d array(search true for boolean array) and wire it to index array, the input of which is state name array. Now, every time the value boolean turns true, it would go in the respective case and dynamically call the vi

-Parag D
-FraggerFox!
Certified LabVIEW Architect, Certified TestStand Developer
"What you think today is what you live tomorrow"
0 Kudos
Message 6 of 7
(3,300 Views)

What Parag says about LabVIEW holding onto the file makes sense. Loading it dynamically might alleviate the problem. Something along the lines of this KB is how you do it.

 

 

Jeff | LabVIEW Software Engineer
0 Kudos
Message 7 of 7
(3,281 Views)