Non capisco perchè non funziona più

Hello everyone,
I can't figure out why the expired medicine check doesn't work anymore. What am I doing wrong?

Regards
Nicola

You call this procedure at the start of Screen1:

The procedure iterates over the global variable Medicine_Dates:

But you did not yet load the global list yet (from TinyDB?)

Mistakes like this are easier to spot if you include those global variables as parameters in your procedure calls.

I followed your advice

but the strange thing is that even though "prova" corresponds to 7/19/2026 and prova2 to 6/19/2026, it tells me that only prova2 has expired.

I don't see why the 7/19/2026 date wasn't caught.

I have only two guesses:

  • Your test device has the current date set wrong, or
  • The tool tip on the MakeInstant block does not mention a possible localized reinterpretation of MM/dd/yyyy as dd/MM/yyyy, changing the comparisons.

I suggest applying Companion Do Its to hard coded samples of those blocks, to see the intermediate results on your device.

1 Like

You can also do the other way round ( hey, there is always someone telling to do in the opposite way… this time it’s me ; - ).

I mean, I prefer saving a timestamp (clock.systemtime ), it is a simple number, easier to compare ( without any conversion ).

You only need to convert in a readable form when you need to display it ( use clock.makeinstantfrom millis and then format the instant as you like )

1 Like

But if label4 sees the two dates, why does it only show me one?:upside_down_face:

You have to move the block highlighted below, outside the for cycle

1 Like

What do you mean outside the for loop?

before the for each loop ( otherwise each time the then is executed the label4 text is overwritten ):

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