Having an issue trying to generate icon in listview

Hello. Sorry for another question. I am trying to import elements from a tinydb into listview. As I import the elements I would like to check the saved end date and generate an appropriate image icon next to the main text header. Here is what I have. The first group loads and populates the list properly. The expired procedure checks the date and assigns the image. When I go to run it the first item in the list has a green icon and all the other items have a red icon no mater what the experation date is.

thanks for any help

This is because you are iterating over the entire list each time.

To set the desired image, use the "result procedure" (which will contain something similar to your expired procedure) in the imageName socket to set the desired image when you create each list item.

Hi. Thank you. I see the result procedure but I am not sure how I would implement it. Forgive me this is my first app using app inventor. When you have some time may I please see how the blocks should be?

Thank you

Some blocks which might help you to see what to do:

make sure that your conditions are discrete, i.e. they can only be one result

Hi. thanks for the block illustration. What I need to do is find all the dates ending within 5 days from todays date and put a yellow icon next to the title in the list. Dates which expired put a red icon. I have tried to modify the setimage procedure but I get an error

Argument to MakeInstant should have form MM/dd/YYYY hh:mm:ss, or MM/dd/YYYY or hh:mm

I need to use the duration block from the clock to find the number of days between todays date and the end date from the database for each item.

this is how i tried to modify it

thank you for any help.

See attached example:

resultSetimage.aia (10.6 KB)

Thank you for the help. I looked at the sample you sent me and with a little tweaking I was able to get it to work properly now. You are awesome! :grinning_face_with_smiling_eyes:

1 Like

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