From Saturday, Nov 23rd 7:00 PM CST - Sunday, Nov 24th 7:45 AM CST, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
From Saturday, Nov 23rd 7:00 PM CST - Sunday, Nov 24th 7:45 AM CST, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
10-31-2024 01:10 PM
Hey Fancy Folk,
As the title states, I am trying to set a Path's "Pattern" property for a control to find all the CW TDMS files. The files are set up like"[SN] - [YY]-[MM]-[DD] [CW/CCW] [test name].tdms" and the folder containing the CW TDMS also has the CCW TDMS.
I tried setting the pattern to "* CW *tdms" in hopes that the pattern would recognize the spaces to force it to only look for " CW " and not " CCW ". However, using "* CW *tdms" yields the CW and CCW files still. I then hoped that I could use "*[0-9] CW *tdms" as my pattern so it would find the "[DD] CW" but that resulted in no returns, since, I believe, the pattern is looking for files with the exact "[0-9]" in plain text and not as a regular expression (I think that's the correct jargon).
I tried searching the help documents and came across https://www.ni.com/docs/en-US/bundle/labview-api-ref/page/properties-and-methods/vi-server/generic/g... which doesn't provide more infomation on a more nuanced pattern, just the basics of what that property is.
I was wondering if anyone else has ran into this issue and if so, how they solved it. I am not the one who made the main code log this way (I'd have used 1 tdms and 2 groups for CW and CCW), I am just the one trying to make a viewer for the data to make life easier for others (hence why I want to make it so the CW selects CW only data), so "change the logging naming convention" isn't an option unfortunately.
Thanks,
Matt
Solved! Go to Solution.
10-31-2024 01:24 PM
Instead of using a specific pattern, just autoindex over the file names and use a conditional output tunnel based on a string analysis of the file name to make a more specific list.
10-31-2024 02:18 PM
What would be really helpful for us to understand your file naming situation and let us "test obvious code" to help figure out a good "pattern match" string would be for you to use LabVIEW to create an array of file names in a folder of the form "[SN] - [YY]-[MM]-[DD] [CW/CCW] [test name].tdms" (you can edit the file and make all the last names "Smith", and if [SN] is a Personal Identifier, you can make all of them "12345". If you want, this can be simply a text file with one file name per line (we can easily use Read Delimited Spreadsheet and turn this text into an Array of Strings, each element being one line of the file).
Distinguishing between CW and CCW files seems really pretty simple, but the Devil is in the Details, as they say...
Bob Schor
10-31-2024 03:15 PM
I don't think you can do it in the dialog box natively. This is an old article, but it gives some info and a link to the newer type:
https://learn.microsoft.com/en-us/windows/win32/dlgbox/open-and-save-as-dialog-boxes
I don't see a way to say "not" in there, but it might give you some more info and might give you some additional search terms.
(This is assuming LabVIEW uses that type of dialog box).
10-31-2024 03:33 PM
10-31-2024 06:04 PM
Why not look for "CC" instead?
11-01-2024 05:40 AM
Works for me ...
11-01-2024 10:28 AM - edited 11-01-2024 10:30 AM
@billko wrote:
Why not look for "CC" instead?
I think the OP wants to be able to open a file browser window that filters the files to ONLY show CW or CCW at different times. Sorting a list of files is easy and I'm sure they could do that, but I think they want to configure the File Path Control to filter out files to only show the ones he wants it to show. For example, normally you could specify *.tdms as the filter string to only show TDMS files. The filter works with the whole filename, not just the extension, so you can use the filter text *CW* to look for only files with CW in the name- but that includes files with CCW in the name. Looking for *CC* lets the OP filter for CCW, but if they want to select only "CW" files they can't filter for that.
As far as I can tell, you can't tell it "not" something, only "look for something", so I don't think it's possible, but I fully reserve the right to invoke Cunningham's Law 🙂
(At least, this is how I'm interpreting OP's problem...)
Edit: Looks like a relevant Stack Overflow post here: https://stackoverflow.com/questions/19857824/openfiledialog-c-sharp-custom-filter-like-abc-pdf
11-01-2024 10:44 AM
OK I take it back. This works for me.
Use *? CW*.tdms for CW, and *? CCW*.tdms for CCW.
All files in the folder:
Filtering for CCW:
Filtering for CW:
11-01-2024 01:06 PM
My overall goal with this post is to have the native "path pattern" for my CW and CCW paths to populate with the CW only for my CW path control and CCW only for my CCW path control. Trying to avoid someone selecting "CCW" twice and not realizing it.
I ended up making the CW pattern "*? CW*tmds" and the CCW pattern "? CCW*tdms" (unneeded since "*CCW*tdms" would have been fine, but wanted to keep the patterns consistent) and that got everything working as I wanted.
Thank you for the help everyone, I really appreciate it!
Matt