Is it possible to update an image automatically if the weather forecast equals a string (e.g. Sun)?

0
Hello I’m new to Mendix and the concept of low-code applications – I’m currently a 1st year student studying high-level programming languages such as: C#, Javascript and Python.  The problem is I’m trying to update an image on my front end so it can dynamically change depending on the current weather conditions. For example:  if the word “Clouds” is shown I want my image to update and display a picture of clouds, if “Rain” is shown the image would show rain (Please refer to the last screenshot).  The attribute I want to use is {Main} but I am unable to write logic so that the image changes depending the value of the attribute.  The object being displayed is selected from a ListView on the homepage – which allows the data to be specific for a selected city. Could you provide a step-by-step guide on how I could achieve this? Any help is invaluable to my learning and is greatly appreciated :)   Moderator edit: removed PLEASE HELP from title. Please don’t use phrases like this in your title.
asked
1 answers
1

I’d recommend using conditional visibility to solve this one. Create multiple image widgets on your page, one for each of the different images you’ll use, and then set a conditional visibility expression for each one. For example, for clouds, the expression would be something like this:

contains($currentObject/Main, 'clouds')

 

answered