I’m working on a Power Apps application where I want to display different images based on the value of a field called ‘Tipo de Ocorrência’. I am using the following formula in the Image property of an Image control:
If(ThisItem.'Tipo de Ocorrência'.Value = "Roubo", "crime.png", If(ThisItem.'Tipo de Ocorrência'.Value = "Acidente", "crash.jpg", "DefaultImage.png"))
enter image description here
However, the images are not displaying as expected. Here are the steps I’ve taken:
1.Verified that the image files “crime.png”, “crash.jpg”, and “DefaultImage.png” are correctly uploaded in the Power Apps media library.
2.Tested each image by setting the Image property directly to “crime.png”, “crash.jpg”, and “DefaultImage.png”, and the images display correctly.
3.Added a Label control to display ThisItem.’Tipo de Ocorrência’.Value to ensure that the field contains the correct values (“Roubo” or “Acidente”).
Despite these checks, the conditional logic does not seem to work, and the images do not appear based on the value of ‘Tipo de Ocorrência’.
What could be the issue, and how can I fix it to ensure the correct image displays based on the condition?
Pedro Adekanbi is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.