LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

user prompt with write to measurement file VI

Solved!
Go to solution

Hello, 

I have a Labview VI thats writing data to a file, currently the file name (file path) is written in the "filename" section of the write to measurement file VI. 
Is there any way in which a user can be prompetd for a file name?

As in, 

 

everytime time I run the VI a diaglog box pops up, that allows the user to type a specific file name (say Run1 or Run 2 and so on..). The file name the user types in should be the name of the file where the data is being written, (using the write to measurement file VI)

I have attached my trial vi. 

 

Thank You,

lana89

Message 1 of 14
(5,620 Views)
Solution
Accepted by topic author spatan2

There is a File Dialog function you can use.  It can be found in the Express->Input or the File I/O->Advanced palettes.


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 2 of 14
(5,603 Views)

Hello,

So I went about using the File Dialog VI 

But this requires the user to enter the new file name every time I run the VI (As opposed to the "Use next available file name" option in the write to measurement VI)
For example, in a given parameter (say at 10 degree F) a user wants to record 5 runs of data. My intention is to have the user select/create a folder path at the first run, enter the desired filename, and have labview use the next available file name there after for the next 4 trials. 

For a new parameter, say 20 degrees F the user should be allowed to select/creat a file path, creat the first *.lvm file in that particilar folder and have labview use the next available filename for how many ever desired trials the user wants at 20F

I tried counting the number of *.lvm files, so that after a set number of files (entered by the user) the option of selecting a folder path pops up again, I get an error. 
I've attached my code, In the VI attached, I've first tried to check if the "array size" function is counting the number of files correctly, but I dont think it is. Its just throwing back the file name in the front pannel and not the actual number of *.lvm files. 

How do I go about doing it?

Please help! Thank you. 

0 Kudos
Message 3 of 14
(5,483 Views)

@Lana89 wrote:


For example, in a given parameter (say at 10 degree F) a user wants to record 5 runs of data. My intention is to have the user select/create a folder path at the first run, enter the desired filename, and have labview use the next available file name there after for the next 4 trials.


Sounds like a place for a FOR loop.  Then you just put the dialog before the FOR loop.


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
0 Kudos
Message 4 of 14
(5,457 Views)

But wont that reset the counter to 1 everytime I run the VI?

0 Kudos
Message 5 of 14
(5,448 Views)

Why would it?  If you put the code into a FOR loop, that section will just be repeated as many times as you tell it to.

 

If you are really worried about that count being reset, then make another VI that calls this VI.  That will keep everything in memory so that nothing is reset.


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
0 Kudos
Message 6 of 14
(5,436 Views)

Hello  again crossrulz,

I am still working on the for loop, but in the mean time, while I try to run my VI,  

I get an error 7 (which doesnt allow me to go further to assess my changes)

Possible reason(s):

LabVIEW: File not found. The file might be in a different location or deleted. Use the command prompt or the file explorer to verify that the path is correct.
=========================
NI-488: Nonexistent GPIB interface.

C:\Users\shresta\Desktop\Labview number of files\1.lvm



How is that, when Ive linked the paths of the list foler function to the selected path option of the file dialog box. is that how it works? or am I getting it all worng?

Thanks. 

0 Kudos
Message 7 of 14
(5,405 Views)

Does C:\Users\shresta\Desktop\Labview number of files\  exist?  If not, that is the only reason I have seen for getting that error when trying to create a file.  If you are not set to create a file, then opening a file that is not there will cause that error.


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
0 Kudos
Message 8 of 14
(5,395 Views)

 

In the path - C:\Users\shresta\Desktop\Labview number of files\, Labview number of files is the folder, in which I create files (*.lvm), through write to measurement VI, but the initial file name is assigned by the user through the "File Dialog VI", while configuring the file dialog VI, the options that checked/selected in the selection mode are: 

 

Limit selection to a single item--> File or folder and new or existing.
Allow selection of files in LLB and packed project libraries (Image attached)

Is this the issue?

 

Thank You.

0 Kudos
Message 9 of 14
(5,388 Views)

Hello Crossrulz,

 

So I figured out a way around it, If I write in the path in the list folder function (Image attached) it works fine, the array size function returns the number of .lvm files. in that particular folder after every run, but my concern is, the path for the list folder  function is typed in, that doesnt make it flexible enough to use the VI, as every time I change the folder I should go into the block diagram and correct the path. 

Thank You

0 Kudos
Message 10 of 14
(5,376 Views)