I am trying to create a time-stamped folder, and then within the folder, create a file called "Report.txt".
See below snippet.
The time-stamped part is correct - no argue about this, because a folder is really created, i.e ..\20120927185155
However in the time-stamped folder, it is empty. Apparently "Report.txt" wasn't created, for some reason.
Solved! Go to Solution.
You have a race condition between creating the folder and creating the file. There's nothing defining the execution order. Make sure the folder is created before trying to create the file. Also, use "build path" (just like you do for the directory) to create the file path instead of converting to a string and back.
Oh yes.. cos it is random. Sometimes the file is created, sometimes not. Most of the time it is not created.
I will try to use a sequence.
I can use a constant instead of "enum"?
Instead of a sequence you could also use data flow (using the path output or the error cluster of create folder). Can be problematic though if there is an error in the create folder function.
What "enum" are you talking about? I don't see an enum in your snippet.
Ah I see. Yes, that works. But I don't see why you would do that.
The constant value gets translated into the corresponding enum position, so as long as the enum does not change using an integer constant will work. I would recommend using an enum constant, this also makes the code easier to read.
Omar beat me to it. Your whole business with the clusters and building of strings and be reduced down to just a Format Time String and a couple of Build Paths. Here's a much cleaner version of your VI.