Dear all,
I use tinyDB to store some date tags (in the format yyyy-MM-dd) and other tags with unstructured data. At one point, I would need to view this data through a listpicker, but I would like either the dates or the other type of text to appear. I tried to separate them but I can't find a way to incorporate the date format with blocks. If anyone could help me I will appreciate it.
you can use this extension:
or you can add a prefix before the tag, like 'date-2024-03-25', 'non-date-blabla', then you can check if the tag contains this prefix.
I would use this value function IsADateTag:
(pseudocode)
procedure isADateTag(inputTag)
init local splitParts to (split inputTag at '-')
do return
(and(length of list (splitParts) = 3),
(is a number(select item 1 of splitParts),
(is a number(select item 2 of splitParts),
(is a number(select item 3 of splitParts))
(That's a four way AND, using its mutator)
This should be all you need.
It will accept any three numbers separated by '-', which would cover just dates in normal cases.
You can add extra range tests (item 1 > 1970) if paranoid.
thank you both for your answer. I will try which one is the best option.
Two suggestions:
- Enabling lpkDates inside its own BeforePicking event should not be necessary.
- If you plan on reusing lpkDates, clear those two output lists to empty lists before starting to fill them, to avoid duplicates.
Thanks for those suggestions. I will erase the enable event inside before picking. I have now declared the filling lists as local, since I just need them only for showing the listpicker in this event.
Excellent choice!
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.