LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Can you put the date into a file path?

Solved!
Go to solution

My program writes spreadsheets. I want there to be a new file everyday, entitled the days date and then data appended to that until the end of the day. Is there anyway to get the date outputted from a 'Get Date/ Time String' and put into the file path for the 'write spreadsheet' function?

 

Also can anyone confirm that a file path going into a write spreadsheet file is for opening the file and the one coming out is for saving and closing?

 

Cheers

 

Sam 

0 Kudos
Message 1 of 17
(10,291 Views)

you can use Format Date/Time String Funtion to get current time in string format, and append it to your base file name.

 

 

For Path Control you can set its Selection Mode (open or create or both) in Browse Options Dialo.

Message Edited by My NI on 08-13-2009 11:46 AM
Message Edited by My NI on 08-13-2009 11:46 AM
Regards
MY
Message 2 of 17
(10,285 Views)

As long as you use characters that are compatible within a path it is up to you to decide what to use. The file path going into a write spreadsheet file is for opening the file. The path going out is only a copy. The file has been closed inside the "write spreadsheet" vi. This is very typical for Labview functions, because in Labview dataflow the flow of data is important. Remember you are free to take a look under the hood on many Labview functions, and modify if needed. Just remember to use the save as function. And do not save your modifications in the vi.lib folder  



Besides which, my opinion is that Express VIs Carthage must be destroyed deleted
(Sorry no Labview "brag list" so far)
0 Kudos
Message 3 of 17
(10,268 Views)

This is a possible solution to your question.

Note that you don't need to do anything after the WriteToSpreadsheet vi

Don't use standard characters like ":" or "/" to seperate your DateTime string.

Windows don't like that Smiley Surprised

SNAG-025.jpg

 

Message 4 of 17
(10,263 Views)

Thanks, that has almost worked for me. My fall plan is to create files of the name 'date_00' or 'date_12' depending if it is before or after mid day. eg now would be '13 Aug 2009_12' When I build the spreadsheet to incorporate the date it adds a \ to signify end of file name. So I have tried to strip the backslash so I can then build _00 or _12 onto the end. However the strip is taking the hole date not just the backslash, so Im getting file names of '_00' and '_12'. Can someone tell me a better way to get rid of this backslash? Screen shot is attached below.

 

Cheers,

Sam 

0 Kudos
Message 5 of 17
(10,244 Views)

please use this fuction

Format Date/Time String Function
Owning Palette: String Functions

Installed With: Base Package



Besides which, my opinion is that Express VIs Carthage must be destroyed deleted
(Sorry no Labview "brag list" so far)
0 Kudos
Message 6 of 17
(10,237 Views)

ssteel wrote:

 

Screen shot is attached below.


Can you post the screenshot?

- Partha ( CLD until Oct 2027 🙂 )
0 Kudos
Message 7 of 17
(10,234 Views)
Solution
Accepted by topic author ssteel

This better?

SNAG-026.jpg

 

Like Coq Rouge already said, use the "Format Date/Time String" vi to keep only the items from DateTime stamp that you need and also choose adequate  seperators.

Keep in mind that "/" & ":" are not allowed in filenames by Windows!

 

Also to keep track of all your files in a folder it's better to name your files "Year-Month-Day" instead of standard "Day/Monyh/Year" (for Europeans at least Smiley Tongue ). That way you can easily find any file back in a larger folder.

 

Do you really have two different folders? One for files before noon and one for files after noon?

If yes keep that code.

If no, modify that code! 

Message Edited by Alain S on 08-13-2009 02:14 PM
0 Kudos
Message 8 of 17
(10,225 Views)

yes, but the code doesnt work, it doesnt just strip the backslash but the whole date?? 

0 Kudos
Message 9 of 17
(10,214 Views)

ssteel wrote:

yes, but the code doesnt work, it doesnt just strip the backslash but the whole date?? 


TFR30E.gif


Besides which, my opinion is that Express VIs Carthage must be destroyed deleted
(Sorry no Labview "brag list" so far)
0 Kudos
Message 10 of 17
(10,212 Views)