LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

A helpful VI to create a new file without colliding with existing


@JÞB wrote:

The one I din't understand completely is the select in reverse scan from string for interger.  I'd probably save some wires and make -1 the default but I'm sure there is a reason.


There is a reason. The reason is that I've always thought of that as a type terminal, not a default value terminal. I can make the change you suggest.

 

However -- in testing that change, I found a bug, one that I don't think I can get around.

 

Scan From String and Format Into String are apparently not reciprical.

 

If I take the number 56 and format it into string using "%01d" and using "%d", I get the same resulting string:

"56"

 

But if I then use Scan From String on the input "56", I get different results:

"%d" ===> 56

"%01d" ===> 5

 

In other words, I cannot guarantee that I can reverse engineer the integer out of a file given a format string used to originally generate the file.

 

Anyone have any ideas?

 

snippet.png

0 Kudos
Message 41 of 48
(2,614 Views)

Hm... this works... I eliminate any of the format codes between the "%" and the "d" when doing the Scan. Can anyone think of circumstances where this would be a bad idea?

 

Untitled.png

0 Kudos
Message 42 of 48
(2,608 Views)

Smiley Embarassed

I kind of found the same dratteded thing I think.  I wanted your eyes on it.

 

Tim's regex has a simillar flaw where the 0n part of %0nd gets ignored for integer strings shorter than but not longer than n.  and you can't really anchor them while excluding the ")"   (Blew my mind!)

 

Honestly, I was hoping I had really really missed something....

 

On the other hand, if you limit the scope to "uniquify": only by given path and last field of file name and define the that field character to be constant,,,,,  ... rather than possibly add a "unique" field and post unique fields.

 

Your proposal would find the last interger field in a filename regaurdless of if its the intended unique field but can be anchored so the "uniqued" feild specifier needs only to require any Post unique formats.... and then it gets really ugly since we don't know how many post unique field format specifiers there are.

 

Limit the scope. to unique field must be anchored..


"Should be" isn't "Is" -Jay
0 Kudos
Message 43 of 48
(2,591 Views)

For some reason, ni.com will not allow me to upload the .zip file containing the VIs. I don't know why... it worked fine last week, but this week it says that the attachment doesn't match its file type. Anyone ever seen this happen before?

 

0 Kudos
Message 44 of 48
(2,559 Views)

@AristosQueue (NI) wrote:

For some reason, ni.com will not allow me to upload the .zip file containing the VIs... Anyone ever seen this happen before?

 


Goes back quite a while, and for some reason is not taken care of, despite regular reminders. I believe the usual suggestion is to change the extension, but you can look at this thread to see if there are other suggestions - http://forums.ni.com/t5/Feedback-on-NI-Discussion-Forums/Problems-uploading-a-ZIP-file/td-p/2465382/


___________________
Try to take over the world!
0 Kudos
Message 45 of 48
(2,553 Views)

Hi Aristos,

 


despite regular reminders


 

Guess it's time for a new bumping of that thread…

 

Around Christmas I already received PMs from NI staff where I was promised some in-depth examination of that problem, but that's now more than 4 month ago…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 46 of 48
(2,546 Views)

Attached is the final. I put a junk file extension on it. Just remove the ".txt" and then unzip the VIs.

0 Kudos
Message 47 of 48
(2,530 Views)

Like many, I've historically created unique / sequential / sortable filenames by adding a leading timestamp.  Timestamp is leading so that sets of files with different descriptors but the same leading timestamp will be listed together during a standard Windows Explorer name sort.  I've included subVIs that I've found useful.

 

 


Certified LabVIEW Architect
TestScript: Free Python/LabVIEW Connector

One global to rule them all,
One double-click to find them,
One interface to bring them all
and in the panel bind them.
0 Kudos
Message 48 of 48
(2,482 Views)