Hi,
Once an item is created, i have a screen in power apps with a gallery that shows me all the items and once clicked it goes to another screen that show more details of that item. One of those details is an attachment field but i replaced it for a gallery (to have kinda like a small img preview), so in the gallery i show all the attachments for that item that can be btwen 1-4 max attachments, the attachments can be of any type in the img control in the gallery it shows perfect if the attachments are img type but if it is another type of file like pdf etc is blank and i have 4 img control in the gallery for all the attachments depending on the amount but since max is 4 im using 4 img controls in the gallery. I need to write in the img control a conditional to check like if the display Name of the attachment is an img type if yes show the imgs attached but if is another type of file to show an img i uploaded in the power app to be like a default img.
All that i found is only for is only one image but i need to do it like in plural, for all the attachments not the first or like that
this code for example:
If(
Last(Split(First(DisplayItem.Attachments).DisplayName,".")).Value = "jpg" ||
Last(Split(First(DisplayItem.Attachments).DisplayName, ".")).Value = "png" ||
Last(Split(First(DisplayItem.Attachments).DisplayName, ".")).Value = "jpeg",
ThisItem.AbsoluteUri,
'file-icon-vector-illustration'
)
it will always only check on the first (checked on the output and the display name is always only the first one)
other one that i tried was something like this ;
If(
Last(Split(First(ThisItem.Attachments).DisplayName, ".")).Result in ["jpg","png","jpeg"],
First(ThisItem.Attachments).Value,
SampleImage
)
But it also does not work is always for an item only.
could anyone help me?
Thanks,