Help with checking dates

I’m trying to make something that shows the 3 closest events that were inputted by the user. I’ve tried a lot of different things, but i cant get any of them to work. the way i have it set up is, there’s three variables named 2023, 2024, and 2025. each one of those has a list of 12 items for each month. in the items it puts the day of the month combined with the name of the event, so, for example, if you have an event called picnic on the 14 of July 2023 it will look like this: variable 2023, item 7, 14.picnic. how would you be able to check if it is before another event?

This is going to be a little confusing using July as an example because it’s the 7th month and you’re also mentioning the 7th item so let’s assume instead that we’re talking about May (the 5th month).

Combine your values into a single text string: 2023/14/05#07. You can use any separators you want such as 2023_14_05_07 or 2023140507. It’s up to you. Just test to make sure they work as expected. If you’re not sure how to use separators, leave them out and use 2023140507. The key is to make sure any single digit values are converted to two digit values (so that the 5th month is represented as “05” instead of “5”; single digit values won’t get sorted properly because 10 comes before 5 alphabetically).

Then sort them however you would normally sort text strings.

i should’ve been clearer, the item in the list is the same as the month. also, how would you sort them?

this is what i tried and its not working, can you help me find why?

You’ll need to troubleshoot the values you expect to be getting.

When you insert a new item into stored variable events, set a label’s text to that same value (the join block). Change the wait block that follows to have a delay long enough to read or screenshot the value (e.g. 3 seconds).

Is it showing what you expect it to?

If so, then a list of those items in a format that I suggested should be sortable as numeric or alphabetical items.

What are you seeing as a result in your cloud variable? What happens if you also set a label’s text to that make text from list block? Do you see the expected value there?

the way i see it, you seem to be formatting the date time part correctly so that a typical entry to your list might be “202306211230.Lunch” - however the result is alphabetic, maybe you should change the sort numeric to sort alphabetic. also i hope your gettime routine returns 1:30pm as 1330 to ensure correct sorting.
you might want to set up a debugging field (make it an input field not a text label) to the value of the unsorted list and another for the sorted list and share those displays with us and point out what makes you think that it’s not working.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.