cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Christelle
Frequent Visitor

html display variable images in a html table

Hi there!

 

I want to create a report containing many items from a Gallery (filtered in PowerApps). Each item has a grade. Upon this grade, a different image should appear. Then, by clicking on a button, the html field is send to power automate to create a pdf.

I manage to get an image in the pdf document, but I cannot manage to change the image upon the grade.

On Start of the app, I set a variable for each grade, containing the image

(for example:

Set(varMatrix22,"data:image/jpeg;base64,/9j/4AAQSkZJRgABAQEAwADAAAD/4REQRX...")

)

 

My report built in html is as following:

 

<table style:'width:100%'>
<tr>
<th style='width:70%'> Risk description</th>
<th>Evaluation</th> <th>Divers to be determined later</th>
</tr>"&Concat(RenameColumns(GalleryReport_1.AllItems,"ID","MainID"),"<tr><td>"&Title&"<br>"&Description&"<table>"&Concat(Sort(Filter(ComplianceRisksAP,IDMainList=MainID),ActionNumber,Ascending),"<tr><td>"&ActionNumber&". "&Title&"</td>
<td> "&PourcentageAchievement&"</td></tr>")&"
</table>"&"</td>
<td>Inherent risk: "&ProbableRisk&"<br> MatrixImage:"&MatrixValue&"
<br>
<img src='"& varMatrix22 &"'>
</td><td>" & QuantiOrUQ &"
</tr>")&"
</table>

 

I would need to change the part in red (22) to be variable (value being 11,22,33,43,44,55, for example, depending on the items in the filtered gallery), or change the whole varMatrix22.

The value comes from the gallery (based on a SharePoint list, column MatrixValue as variable to get the right image).

 

Has anybody an idea how I could do this?

If not directly in Powerapps (favorite solution), maybe with power automate?

 

Thanks a lot in advance for you help.

 

Kind regards,

 

Christelle

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Jeff_Thorpe
Super User
Super User

 

You will need to use an If() or Switch() to execute the correct variable name. Here is an example that assumes MatrixValue returns a number that relates to an image variable:

 

<img src='"& Switch( MatrixValue, 11, varMatrix11, 22, varMatrix22, 33, varMatrix33 , 44, varMatrix44, 45, varMatrix45) &"'>

 

 

 



--------------------------------------------------------------------------------
If this post helps answer your question, please click on “Accept as Solution” to help other members find it more quickly. If you thought this post was helpful, please give it a Thumbs Up.

View solution in original post

2 REPLIES 2
Jeff_Thorpe
Super User
Super User

 

You will need to use an If() or Switch() to execute the correct variable name. Here is an example that assumes MatrixValue returns a number that relates to an image variable:

 

<img src='"& Switch( MatrixValue, 11, varMatrix11, 22, varMatrix22, 33, varMatrix33 , 44, varMatrix44, 45, varMatrix45) &"'>

 

 

 



--------------------------------------------------------------------------------
If this post helps answer your question, please click on “Accept as Solution” to help other members find it more quickly. If you thought this post was helpful, please give it a Thumbs Up.
Christelle
Frequent Visitor

Dear Jeff,

 

it works perfectly. I would never have come to this syntax. I had the idea of if or switch but needed the help.

Now I can stop working during my vacation and start baking for Christmas eve...

Thanks a lot!

KR,

 

Christelle

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

365 EduCon 768x460.png

Microsoft 365 EduCon

Join us for two optional days of workshops and a 3-day conference, you can choose from over 130 sessions in multiple tracks and 25 workshops.

Users online (2,886)