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.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Path Control Pattern value, how do I differentiate between "CW" and "CCW"?

Solved!
Go to solution

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

Attention new LV users, NI has transitioned from being able to purchase LV out right to a subscription based model. Just a warning because LV now has a yearly subscription associated with it.
0 Kudos
Message 1 of 10
(387 Views)

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.

0 Kudos
Message 2 of 10
(379 Views)

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

0 Kudos
Message 3 of 10
(364 Views)

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).

0 Kudos
Message 4 of 10
(348 Views)
Solution
Accepted by topic author Matt_AM

Try   "*-?? CW*.tdms"

 

Ben

0 Kudos
Message 5 of 10
(343 Views)

Why not look for "CC" instead?

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
Message 6 of 10
(324 Views)

Works for me ...

Yamaeda_0-1730457600340.png

Yamaeda_1-1730457628807.png

 

 

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 7 of 10
(293 Views)

@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

Message 8 of 10
(268 Views)
Solution
Accepted by topic author Matt_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:

 

BertMcMahan_0-1730475810663.png

 

Filtering for CCW:

 

BertMcMahan_1-1730475821258.png

 

Filtering for CW:

 

BertMcMahan_2-1730475832389.png

 

Message 9 of 10
(260 Views)

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

Attention new LV users, NI has transitioned from being able to purchase LV out right to a subscription based model. Just a warning because LV now has a yearly subscription associated with it.
Message 10 of 10
(221 Views)