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

display graphs inside Power apps html text control

Hello.

Is there any way to insert graphs inside the HTML text control so it can be added inside email body? I have a collection named 'Job applications' in my app. For this collection, I am able to create an HTML table inside the HTML text control with <table><th><tr> tags.I'm able to email the info inside the HTML text control.  However I couldn't find a way to graph the collection and show it inside the HTML text control. My collection has fields "Region","Job title" and I want to group by "Region" and count "Job titles".

1st question : Is there a way to Group the collection by "Region" and display bar graph inside the HTML text control? Y axis is Count all "Job titles" inside each region.

 

2nd question: Is there any way to display the  Data Table created on another screen inside the HTML text control?

2 ACCEPTED SOLUTIONS

Accepted Solutions
EddieE
Solution Sage
Solution Sage

@yohannes_adeba 
You can add a table to your HTML text, like this

"
<head>
<style>
table {
  font-family: arial, sans-serif;
  border-collapse: collapse;
  width: 100%;
}

td, th {
  border: 1px solid #dddddd;
  text-align: left;
  padding: 4px;
}

th {
  background-color: LightGray;
}

tr:nth-child(even) {
  background-color: #dddddd;
}
</style>
</head>

<table>
    <tr>
        <th>Region</th>
        <th>Job Titles</th>
    </tr> " &
    Concat( 
        AddColumns(
    GroupBy(yourCollectionName, "Region", "grpRegion"),
    "Job Titles",
    CountRows(grpRegion)
    ),
        "<tr>
            <td>" & Region & " </td>
            <td>" & 'Job Titles' & " </td>
        </tr>
  ")
& "
</table>"

** Note: all of the html code inside of the <head> ... </head> tags just sets the table style. You can adjust this to suit your needs.

 

You send a test email to yourself to check this using

// note: htmlTable is the name of my HTML text control
Office365Outlook.SendEmailV2("youremail@yourcompany.com", "HTML Table", htmlTable.HtmlText)

Looks something like this

EddieE_0-1656641717282.png

 

 

For adding your graph image to the email, this old solution may work? If not, then I think you may need to do some research to get it working, sorry.

View solution in original post

@yohannes_adeba 
Just use '.' to give the required data - usually you can use something like Region.Value, eg

"
...
<tr>
            <td>" & Region.Value & " </td>
            <td>" & 'Job Titles' & " </td>
            <td>" & 'Éxtra column 1' & " </td>
            <td>" & 'Éxtra column 2' & " </td>
        </tr>
..."

 

View solution in original post

5 REPLIES 5
EddieE
Solution Sage
Solution Sage

@yohannes_adeba 
You can add a table to your HTML text, like this

"
<head>
<style>
table {
  font-family: arial, sans-serif;
  border-collapse: collapse;
  width: 100%;
}

td, th {
  border: 1px solid #dddddd;
  text-align: left;
  padding: 4px;
}

th {
  background-color: LightGray;
}

tr:nth-child(even) {
  background-color: #dddddd;
}
</style>
</head>

<table>
    <tr>
        <th>Region</th>
        <th>Job Titles</th>
    </tr> " &
    Concat( 
        AddColumns(
    GroupBy(yourCollectionName, "Region", "grpRegion"),
    "Job Titles",
    CountRows(grpRegion)
    ),
        "<tr>
            <td>" & Region & " </td>
            <td>" & 'Job Titles' & " </td>
        </tr>
  ")
& "
</table>"

** Note: all of the html code inside of the <head> ... </head> tags just sets the table style. You can adjust this to suit your needs.

 

You send a test email to yourself to check this using

// note: htmlTable is the name of my HTML text control
Office365Outlook.SendEmailV2("youremail@yourcompany.com", "HTML Table", htmlTable.HtmlText)

Looks something like this

EddieE_0-1656641717282.png

 

 

For adding your graph image to the email, this old solution may work? If not, then I think you may need to do some research to get it working, sorry.

yohannes_adeba
Frequent Visitor

Thank you so much, Eddie. The table worked but please allow me to ask an extended question. 1. Can I add additional column(s) here?

Region(group by)Total(Job title)%age of Job tile
   

 

2. What if the 'Region' column is of choice type.

@yohannes_adeba 

Yes, you can add Headers where the <th> tags are and then associated data where the <td> tags are inside of the Concat(), ie

 

<table>
    <tr>
        <th>Region</th>
        <th>Job Titles</th>
        <th>Extra column 1</th>
        <th>Extra column 2</th>
    </tr> " &
    Concat( 
        AddColumns(
    GroupBy(yourCollectionName, "Region", "grpRegion"),
    "Job Titles",
    CountRows(grpRegion)
    ),
        "<tr>
            <td>" & Region & " </td>
            <td>" & 'Job Titles' & " </td>
            <td>" & 'Éxtra column 1' & " </td>
            <td>" & 'Éxtra column 2' & " </td>
        </tr>
  ")
& "
</table>"

 

yohannes_adeba
Frequent Visitor

Thanks Eddie. But my "Region" column is of choice type. This one is working only when it's a single-line-text type. Do you have any so/n if the "Region" is of choice type?

@yohannes_adeba 
Just use '.' to give the required data - usually you can use something like Region.Value, eg

"
...
<tr>
            <td>" & Region.Value & " </td>
            <td>" & 'Job Titles' & " </td>
            <td>" & 'Éxtra column 1' & " </td>
            <td>" & 'Éxtra column 2' & " </td>
        </tr>
..."

 

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.

Carousel_PP_768x460_Wave2 (1).png

2022 Release Wave 2 Plan

Power Platform release plan for the 2022 release wave 2 describes all new features releasing from October 2022 through March 2023.

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.

Top Solution Authors
Users online (3,387)