09-17-2013 05:16 AM
Hello,
I'm a student. I'm doing a code and I can not solve a problem.
I have to compare the elements of an array (indefinite number of elements) with two strings. Specifically, I need to compare the date with the string indicating the date and time with the one showing the time.
Is there a way to do this cycle?
I enclose a picture showing the array and strings with which I have to compare elements in the array.
Thanks
09-17-2013 05:21 AM
It's simple, connect your string array to a for loop and do your comparisons inside (you'll then work on 1 item at a time). If you wire the results out of the loop you'll get an array of results as standard.
/Y
09-17-2013 05:31 AM
Ok, thank you.
But there is another problem:
first I have to break down the elements of the array "data" and "time" so I can compararare it with the string separately.
Can I do, or is there an easier way to make the comparison?
09-17-2013 06:05 AM
Check out the 'Get Date/Time String' function. This will split it for you.
09-17-2013 10:00 AM
To Yamaeda:
Do you understand my problem? is there a way to pass it?
To Mike:
I have no difficulty to get the current date and time. I can not separate the two terms (date and time) of the array elements.
09-17-2013 10:04 AM - edited 09-17-2013 10:04 AM
Hi gmazza,
- use SpreadsheetStringToArray with "-" as separator...
- use SplitString with offset
- use MatchPattern with "-"
- don't forget TrimWhitespace, it's a handy function 😄
There are so many functions in the string palette, did you even try one of these?
09-17-2013 10:11 AM
GMazza,
I have a feeling you are looking at 'Get Date/Time In Seconds'. You want to use 'Get Date/Time String'.
As Yamaeda said, use the for loop to get each element of the array, use the 'Get Date/Time String' function to split into Date and Time, then compare against your constant Date and Time values.
Or you could just use one of GerdW's suggestions