cancel
Showing results for 
Search instead for 
Did you mean: 
Reply

Create HTML from collection

Hello everybody,

is it possible to create multiple and individual HTML documents from data that is inside a collection? We are gathering our data in a collection and by pressing a button the data will be send to our SharePoint online datasource.

I‘ve tried to use the ForAll Function but without success.

Best regards.
1 ACCEPTED SOLUTION

Accepted Solutions
PowerApps Staff CarlosFigueira
PowerApps Staff

Re: Create HTML from collection

In this case, you can create the HTML based on the data from your forms as you are collecting them into the 'colMyItems' collection. For example, expanding on your example, you could use something like below:

Collect(
    colMyItems;
    AddColumns(
        Table({
            itemA: TextInput1.Text;
            itemB: TextInput1_1.Text;
            itemC: TextInput1_2.Text
        });
        "myHtml";
        "<table border='1'>" &
            "<tr><th colspan='2'>" & itemA & "</th></tr>" & 
            "<tr><td>" & itemB & "</td><td>" & itemC & "</td></tr></table>"))

The attached app shows this expression being used. To open it, save it locally, then go to https://create.powerapps.com, then choose Open, Browse and find the file you previously saved.

Hope this helps!

4 REPLIES 4
PowerApps Staff CarlosFigueira
PowerApps Staff

Re: Create HTML from collection

There are a few ways how you can compose HTML from data in a collection; can you give some example of the data that you have, and what you want the output to be?

For example, if you have a collection like this one:

ForumPost001.png

You could convert it to HTML using the Concat function like in the example below:

"<table>" &
Concat(
    Countries,
    "<tr><td rowspan=""2""><img src=""" & Flag & """ width=""80"" height=""60""></td>" &
        "<td><b>" & Country & "</b></td></tr>" &
        "<tr><td>" & Population & "</td></tr>") &
"</table>"

Hope this helps!

Re: Create HTML from collection

Hi @CarlosFigueira,

thanks I really appreciate your support.

 

I have got a form (myForm) to fill in and a collection named 'colMyItems' which collects the form data (the process repeats when I press a button to locally save the form data to 'colMyItems'). So 'colMyItems' contains the data from multiple completed forms (myForm).

 

For example:

Collect(colMyItems; {itemA: valueA; itemB: valueB; itemC: valueC})

 

Now I want to create single HTML files for each form (which are saved in 'colMyItems').

 

Best regards and thanks in advance!

 

 

PowerApps Staff CarlosFigueira
PowerApps Staff

Re: Create HTML from collection

In this case, you can create the HTML based on the data from your forms as you are collecting them into the 'colMyItems' collection. For example, expanding on your example, you could use something like below:

Collect(
    colMyItems;
    AddColumns(
        Table({
            itemA: TextInput1.Text;
            itemB: TextInput1_1.Text;
            itemC: TextInput1_2.Text
        });
        "myHtml";
        "<table border='1'>" &
            "<tr><th colspan='2'>" & itemA & "</th></tr>" & 
            "<tr><td>" & itemB & "</td><td>" & itemC & "</td></tr></table>"))

The attached app shows this expression being used. To open it, save it locally, then go to https://create.powerapps.com, then choose Open, Browse and find the file you previously saved.

Hope this helps!

Highlighted

Re: Create HTML from collection

Hi @CarlosFigueira,

 

this works like a charm!

 

Thank you so much.

 

Best regards.

Helpful resources

Announcements
firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

FirstImage

Power Platform World Tour

Coming to a city near you

thirdimage

PowerApps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

FourthImage

Join PowerApps User Group!!

Connect, share, and learn with your peers year-round

SecondImage

Power Platform Summit North America

Register by September 5 to save $200

Top Kudoed Authors
Users Online
Currently online: 182 members 4,953 guests
Please welcome our newest community members: