10-27-2021 07:01 PM
Hello!
At work we have a device that we are constantly monitoring and logging temperature of.
Is there a simple way that I can have the path change automatically based on date?
Ideally it will log all day and once the date has changed, it will create a new folder can start then depositing all the data into that folder
Any thoughts or opinions are appreciated
Solved! Go to Solution.
10-28-2021 04:38 AM
Of course, simply build a string with all dates, times, labels, etc. in it, and build a path from it.
For example (there are dozens of ways to do this):
You can use Create Folder and\or Check If File Or Folder Exists.vi to optionally make the path hierarchy.
10-28-2021 06:30 AM
Hello,
Please read below article, It's surely help you.
https://knowledge.ni.com/KnowledgeArticleDetails?id=kA03q000000YH93CAG&l=en-IN
10-28-2021 08:20 AM
wiebe@CARYA wrote:
You can use Create Folder and\or Check If File Or Folder Exists.vi to optionally make the path hierarchy.
I tend to just try to create the folder unconditionally. If it already exists, you will get error 10 ("duplicate path"), which you can just ignore with the Clear Errors VI (has an input for only clearing specific errors).
10-28-2021 11:55 AM
@crossrulz wrote:
wiebe@CARYA wrote:
You can use Create Folder and\or Check If File Or Folder Exists.vi to optionally make the path hierarchy.
I tend to just try to create the folder unconditionally. If it already exists, you will get error 10 ("duplicate path"), which you can just ignore with the Clear Errors VI (has an input for only clearing specific errors).
At some point, there was no way to create multiple folders at one, so if for c:\a\b\c, b and c needed to be created, it had to be done in a loop.
It's been a while, and I forgot the details. I think at some point the function started doing that.
10-28-2021 12:07 PM
wiebe@CARYA wrote:At some point, there was no way to create multiple folders at one, so if for c:\a\b\c, b and c needed to be created, it had to be done in a loop.
It's been a while, and I forgot the details. I think at some point the function started doing that.
That is what I have gathered based on OpenG's version of Create Folder. But it has been quite a while that I have been using the primitive for creating "deep" directories in the single call. I just verified that it works that way with LabVIEW 8.2.1.
Now just don't try to create a file in a folder that does not exist. That will still throw an error.
10-28-2021 12:09 PM
wiebe@CARYA wrote:
@crossrulz wrote:
wiebe@CARYA wrote:
You can use Create Folder and\or Check If File Or Folder Exists.vi to optionally make the path hierarchy.
I tend to just try to create the folder unconditionally. If it already exists, you will get error 10 ("duplicate path"), which you can just ignore with the Clear Errors VI (has an input for only clearing specific errors).
At some point, there was no way to create multiple folders at one, so if for c:\a\b\c, b and c needed to be created, it had to be done in a loop.
It's been a while, and I forgot the details. I think at some point the function started doing that.
I seem to remember that as well, but maybe it's the power of suggestion making me susceptible to mass hallucination.
10-28-2021 01:54 PM
Thank you all so much for the quick responses, I will definitely read that article and try mimicking that sample given
Thanks again!
10-28-2021 02:20 PM
Same memory here that "once upon a time", the LabVIEW Create Folder could only create one level at a time. I remember using the OpenG version specifically *because* it would create as much of the nested folder hierarchy as necessary, whereas the native primitive version would not.
A less trustworthy memory makes me think it was still this way in LV 7.
-Kevin P
10-28-2021 07:09 PM
First off I want to apologize, im sure there are way more pertinent or interesting questions out there than this, but if you would be so kind to help me just a little bit more. Im finding issue on where exactly to implement your suggested portion. Attached is an image of a simplified VI and the result, in this example Im using time instead of an Analog Input with the temperature reading. In my initial post I mentioned dropping the data into separate folders however im perfectly ok with having one folder with multiple CSVs that represent each day. It seems by doing it this way I can have a constant file path and just create the files using your portion. Where I need help is locating where to put your portion in relation to the while loop that will constantly be running. If it is outside, the path only gets created once, if its inside it will get created every iteration which overwrites the previous iteration. I have tried to put a case structure inside the while loop that compares the initial date to a constantly changing date and if they are not equal then it runs the portion you suggested, however I was struggling to get anything that would accomplish the task. Again I appreciate you help and any suggestions would be great!