08-13-2009 04:23 AM
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
Solved! Go to Solution.
08-13-2009 04:45 AM - edited 08-13-2009 04:46 AM
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.
08-13-2009 05:01 AM
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
08-13-2009 05:08 AM
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
08-13-2009 06:06 AM
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
08-13-2009 06:17 AM
please use this fuction
Format Date/Time String Function
Owning Palette: String Functions
Installed With: Base Package
08-13-2009 06:35 AM
ssteel wrote:
Screen shot is attached below.
Can you post the screenshot?
08-13-2009 07:13 AM - edited 08-13-2009 07:14 AM
This better?
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 ). 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!
08-13-2009 07:29 AM
yes, but the code doesnt work, it doesnt just strip the backslash but the whole date??
08-13-2009 07:34 AM
ssteel wrote:yes, but the code doesnt work, it doesnt just strip the backslash but the whole date??