LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Pattern constraint in File Dialog Express VI not working

Solved!
Go to solution

Hello all,

 

I have a simple VI to open and read a file.  I am using "File Dialog Express VI" to obtain the filename from the user, in order to use the "pattern" input to constrain the filetype.  Unfortunately, this does not appear to constrain the file list in any way.  I attach a picture of my code, and the dialog box produced when it runs, demonstrating that the VI does not in fact limit the file list.  Is this a bug?  Does anyone know how to fix it?  I am running LV 2010 10.0 32 bit on a 2.93 GHz Intel Core i7 iMac with Mac OS X 10.6.4.

 

Thanks,

 

Riprock99

0 Kudos
Message 1 of 24
(4,099 Views)

I would suggest that you use a file path control instead of the express VI.  This will offer you more control.  Once you place the path control on your front panel right click on it and go to browse options.  There you will be able to set your pattern and the name.  I have confirmed this on the default installation of LabVIEW.  You can see the results in the attached screenshots.  Try this and if you are still having issues, confirm that you have the default installation of LabVIEW installed.

 

Brandon Treece

Applications Engineer

National Instruments

Download All
0 Kudos
Message 2 of 24
(4,065 Views)

Hi Brandon,

 

Thanks for the suggestion.  I have tried it, and have two questions:

 

1)  Can the file path control be executed at run time?  When I hit the run button, the file path control gives me an error:

 

 

Error 1430 occurred at Open/Create/Replace File in Read simple.vi->ShowAvg2.vi
Possible reason(s):
LabVIEW:  The path is empty or relative. You must use an absolute path.
:/Users/anderson/Desktop

 

Possible reason(s):LabVIEW:  The path is empty or relative. You must use an absolute path.:/Users/anderson/Desktop

 

I can set it pre-emptively, but my code doesn't work that way.  It needs to work with a user selectable file.

 

2)  I set the pattern to *.max (see first figure), but it still shows me all of the files in the directory when I manually select the path by left clicking the folder icon (see second figure).  What gives?

Screen shot 2010-10-25 at 9.14.17 AM.png

 

Screen shot 2010-10-25 at 9.15.45 AM.png

 

Thanks,

 

Scott

0 Kudos
Message 3 of 24
(4,019 Views)

You should use the file dialog vi before the open file.  This will open a dialog box to search for you file.  

 

Capture.PNG

 

I tested this on a Mac OS X and had no issues.   You should include a pattern name.   See my previous post for the attached images.  You will see the pattern name in the dialog box.  Hope you find this helpful.

 

Brandon Treece

Applications Engineer 

National Instruments

0 Kudos
Message 4 of 24
(4,001 Views)

Hi Brandon,

 

So I potentially will be getting a list of file names, then looping over them, first reading the file, analyzing it, and displaying the result.  As such, I am using the file path before I do the open/read, however, my open and read is in a subroutine.  Basically, I am handing a filename to a read subroutine.  How can I do this without it choking?  Here are figures of my example, and my read subroutine.  I can post the VI, but I don't have any small data files to send as an example.  The first figure shows the main program.  I have not yet installed the loop, but I intended to place it around everything but the file path control.  The second image is of the actual read routine.

 

Thanks in advance for your thoughts!

 

S-

 

Screen shot 2010-10-26 at 10.54.23 AM.png

 

 

Screen shot 2010-10-26 at 10.54.49 AM.png

Download All
0 Kudos
Message 5 of 24
(3,992 Views)

Whoops - OK - I see my last post missed the idea of a file dialog vi.  However, all I see is the file dialog express vi.  Is this what you mean?  It has a different icon than the one shown in your post...

 

Thanks,

 

S-

0 Kudos
Message 6 of 24
(3,991 Views)

Hmm - I can't figure this out - still seems like it isnt working

 

Screen shot 2010-10-26 at 12.52.34 PM.png

0 Kudos
Message 7 of 24
(3,973 Views)

To amplify, it appears that LV 2010.0 does not have a file dialog VI (other than the express one, which we have already established has a bug of some sort).  Smiley Sad

0 Kudos
Message 8 of 24
(3,970 Views)

The pattern constraint works just fine for me in the File Dialog Express VI with LV2010 on WinXP.

 

My guess is if there is a bug, then it's because you are using a Mac.  The screenshots you show of the Mac file dialog box doesn't even show the ability to select different file extensions.

0 Kudos
Message 9 of 24
(3,961 Views)

Actually, I would argue that there is a bug _because_ of a coding error in LV for the Mac, not _because_ I am using a Mac.  🙂

0 Kudos
Message 10 of 24
(3,959 Views)