03-12-2018 04:18 AM
I have a tab-delimited text file, with Date, Time & Status(Pass/Fail) columns.
I need to count the number of occurrences of PASS or FAIL status items within the selected dates.
So, if I select Date from 01/01/2018 to 01/02/2018, then I should get the count of all the PASS & FAIL status within these dates.
I am using Labview version 17(Eval).
03-12-2018 05:06 AM
Do some (free) courses.
Read the file.
Convert columns to values (Timestamps and Booleans).
Use a Threshold function to find the time indices of the begin and end.
Use the begin and end indices to loop over the Boolean array and add if true.
Let us know what you've tried and where you failed...
03-13-2018 07:50 AM
Thanks for the suggestion.
As you have figured out, that I am new to Labview.
I read the tab-delimited text file, and using index arrays, I managed to get the output in the form of strings. So I have the Date string, Time string & the Status string as individual elements.
Now , my question is, is there a way in Labview, to convert date-time values to timestamp value?
03-13-2018 08:42 AM
@depme wrote:I read the tab-delimited text file, and using index arrays, I managed to get the output in the form of strings. So I have the Date string, Time string & the Status string as individual elements.
I hope you're using Spreadsheet String To Array for that? At least look into it.
@depme wrote:
Now , my question is, is there a way in Labview, to convert date-time values to timestamp value?
Scan From String does that. Click it's detailed help, and all the way at the bottom there is an example to scan a date\time string. You should use a format string like %<%H:%M:%S%2u%m/%d/%y>T.
The formatting is the same as Format Date\Time String (but it works in reverse). The help on Format Date\Time String is a bit more elaborate.
03-13-2018 10:48 AM
Are the entries sorted by date?
Are all entries either PASS or FAIL or are there other conditions (blank, not measured, unknown, etc). How big is the file? How clean is the file? Is it computer generated or potentially edited by humans. Is the data format always exactly the same? Are there lines that don't have data (headers, separators, etc.)
So the inputs are "file name", "start date" and "end date" and the output is a single integer and an error status. Is that right?
03-14-2018 12:04 AM
The data assumed is unsorted by date & is actually present in multiple tab-delimited files having multiple other columns.
For simplicity & for my Labview holds-on, I have saved all the data manually in a tab-delimited text file, and only taken Date, Time & Status columns, to start my Labview practical.
So, I have to read this file, then select "start date" and "end date", and then get the count of how many Passed & how many Failed.
Attached is the data file in tab-delimited format.
03-14-2018 04:17 AM
Ok, the unsorted date\time adds a factor of complexity.
Two ways to deal with it:
1) parse all rows and sort on date\time after converting it o a timestamp
2) Loop over all rows and check if the value is within the begin\end range. If so, add 1 if it passed.
1) Is probably a bit more intuitive and easier to debug. 2) Could be faster if the files get large. The entire file does not need to be read at once, the file can be read line by line, reducing the need for memory. That would get significant if the files get larger then several MB (1?, 10?, 100? how knows).
03-14-2018 04:43 AM
Here's method 2. Method 1 would be very similar (the string parsing could be reused).
03-15-2018 12:14 AM
Thanks for the solution.
It will certainly help.