08-01-2017 04:24 AM
Hi,
In my program, after each run , the VI generate a data file with auto sequencing (thanks to NI discussions). I would like to have a list (lets say 'index' file) of all this files in the folder.This index file should get updated (appended) with new filename after each run. Below attached are 'main VI' while 'datainput' and 'Folder store' are sub VI.
thanks in advance
Solved! Go to Solution.
08-01-2017 05:31 AM
08-01-2017 09:04 AM
Hi, I tried putting List Folder the end but i do not know the data type of it. I used "spreadsheet string to array function" but did not work.
Actually i thought of making a array with timestamp (as first column) and file name (as second column). This array will be updated each time a new file is generated in that folder.
Do write back.
08-01-2017 09:10 AM
@SanjoyJena wrote:
Hi, I tried putting List Folder the end but i do not know the data type of it.
The List Folder outputs an array of strings for the files in that folder. What is confusing about that?
08-01-2017 10:56 AM
What is the purpose of this "index file"?
Viewing a folder in windows explorer gives you a list of files and when they were created, is there a good reason to replicate this?
08-01-2017 11:23 PM
Hi,
Index file is supposed to be like a stack. Everytime i run my "main VI", "index fie" appends the filename to the list of filenames with timestamp.
I have tried out a way. Please check this and suggest if some better way is there.
The "List Folder function" cannot be updated in every run as it shows error for 'duplicate', Rather it is useful if one wants to generate the list of filename at the end of measurement not dynamically.
08-02-2017 01:19 AM - edited 08-02-2017 01:20 AM
Hi Jena,
this looks all so complicated…
What about this one:
- Why do you need to search for this "index.txt" file when you use this filepath anyway? You already enabled append mode of WriteSpreadsheetFile so new entries will ba appended to the end of the file.
- You subVI expects an array of filenames so you should create a 2D array of timestamps and filenames to append to the spreadsheet…
- Why do you use a format string of "%g" for strings? Did you read the help for those format strings?
- All your VIs will improve by using AutoCleanup…
08-02-2017 02:39 AM
Hi
Ans1: Thanks for pointing it out. I will change it.
Ans2: for this, I changed the Loop count in "for loop" to 1, so that it runs only once in each run of mainVI. i have removed the 2D array input to simple string input.So now my subVI only expects a string not an array.
Ans3:I missed it as i copied that part from 'store VI'.
Ans4: I will do it
if any others correction are needed, do write back
08-02-2017 02:44 AM
Actually , conditional for loop excepts array (in indexfilegen), but my sub VI gives string as output , so by putting this string though a "build an Array Function", it converts a string into array of dimension 1X1. This array can be given as an input to conditional for loop.
08-02-2017 03:12 AM
Hi Jena,
creating an array from your single string (in the calling VI) is ok when the subVI is creating in a "generic" way to handle not just one new entry for the index file.
But why do you need a conditional FOR loop? And why did you set the condition to never occur?