12-16-2012 09:49 PM
Kindly help me sort out the order by problem.
I have a date array which goes like;
12/3/2012
11/3/2012
12/5/2012
12/8/2012
12/6/2012
12/12/2012
12/10/2012
12/17/2012
I need to arrange it in ascending order, like
11/3/2012
12/3/2012
12/5/2012
12/6/2012
12/8/2012
12/10/2012
12/12/2012
12/17/2012
Please help.
Thank you in advance.
12-16-2012 10:07 PM - edited 12-16-2012 10:11 PM
Hi
I believe you have an array of strings. Use the Sort array function available in the Arrays palette. that should sort the array in ascending order as you wanted.
I missed one thing. when you sort it, you would get 12/17/2012 before 12/3/2012.
hmmmm...
12-16-2012 10:10 PM
sort array by ascending or decending does not give as required.
It gives out the result in a jumbled manner.
12-16-2012 10:13 PM
i realized it a bit before you replied.
anyways, can you post your code in LV2010?
12-16-2012 10:14 PM
Convert the time to second and then use the sort array and then back convert to time stamp.
12-16-2012 10:16 PM
There is a work around, i was looking for in the forums
since you have the dates and not time (sicne you did not say anything about time),
http://forums.ni.com/t5/LabVIEW/time-date-string-to-timestamp/m-p/1644284/highlight/true#M590419
refer to the link below. convert the string time to timestamp. you can use a constant time with all values.
then covnert the timestamp to double number, sort the array in ascending order.
then convert the numeric time value to string and extract only the date info.
12-16-2012 10:23 PM
is'nt there any easier method to sort a time array ?
12-16-2012 10:37 PM
This is one of the method to sort the array.
12-17-2012 12:14 PM
@Grugh_Mike wrote:
is'nt there any easier method to sort a time array ?
It's a lot easier than trying to manipulate the strring into yyyy/dd/mm format and sorting alphabetically.
12-17-2012 12:19 PM
Well that sort of depends, if the code that generates the timestamp in the first place is under your control, just generate it in that order to begin with.