web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Select multiple items ...
Power Apps
Answered

Select multiple items in gallery and have each save as an individual PDF

(0) ShareShare
ReportReport
Posted on by 12

I have a gallery looking at a dummy SharePoint list (hence the random names) which I've set up to select items using a check box, can select and deselect all and has an item count.

 

Kristi2_0-1715922912692.png

I have an HTML Text field that displays what the entire document would look like as a PDF, and have a flow that is working, kind of, when selecting the PDF button. The issue is my flow is only running for the first selected item multiple times, instead of running for each individual item selected. Not sure if it's something to do with the HTML or the PDF Test button, but here's all of the info for those fields:

 

HTML:

 

"<!DOCTYPE html>


<html>
<head>
<style>
table, th, td {
  border: 1px solid black;
  border-collapse: collapse;
}


th, td {
  padding: 15px;
}
</style>
</head>
<body>


<h2 style='text-align:center;font-family:verdana'>Audit the Auditor - SRG</h2>
<h3 style='text-align:center;font-family:verdana'> " & galAllAudits.Selected.'Audit Date' & "</h3>


<table style='width:100%;font-family:verdana';>
  <tr style='background-color:LightGray;height:50px';>
    <th>Supervisor/Coach</th>
    <th>CCR</th>
    <th>UCID/CEC #</th>
  </tr>
  <tr style='height:50px'>
    <td style='text-align:center;'> " & galAllAudits.Selected.'Sup/Coach' & "</td>
    <td style='text-align:center;'> " & galAllAudits.Selected.CCR & "</td>
    <td style='text-align:center;'> " & galAllAudits.Selected.'UCID/CEC' & " </td>
  </tr>
  </table>
 <table style='width:100%;font-family:verdana'>
  <tr style='background-color:LightGray;height:50px'>
    <th>Rating</th>
    <th>Overall</th>
  </tr>
  <tr style='height:50px'>
    <td style='text-align:center;'> " & galAllAudits.Selected.Rating.Value & " </td>
    <td style='text-align:center;'> " & galAllAudits.Selected.Overall.Value & " </td>
  </tr>
</table>
<table style='width:100%;font-family:verdana';>
  <tr style='background-color:LightGray;height:50px';>
    <th>Requirements</th>
    <th>Audit</th>
    <th>Original</th>
  </tr>
  <tr>
    <th>Accountability</th>
    <td style='text-align:center;'>" & galAllAudits.Selected.Accountability.Value & "</td>
    <td style='text-align:center;'>" & galAllAudits.Selected.'Acc Orig'.Value & "</td>
  </tr>
  <tr>
    <th>Proactive Communication</th>
    <td style='text-align:center;'>" & galAllAudits.Selected.'Proactive Communication'.Value & "</td>
    <td style='text-align:center;'>" & galAllAudits.Selected.'PC Orig'.Value & "</td>
  </tr>
  <tr>
    <th>Timely Feedback</th>  
    <td style='text-align:center;'>" & galAllAudits.Selected.'Timely Feedback'.Value & "</td>
    <td style='text-align:center;'>" & galAllAudits.Selected.'TF Orig'.Value & "</td>
  </tr>
</table>
<table style='width:100%;font-family:verdana'>
    <tr style='background-color:LightGray;height:50px';>
        <th>Positive Feedback</th>
        <th>Opportunity Feedback</th>
    </tr>
    <tr style='width:50%,height:50px'>
        <td style='text-align:center;'>" & galAllAudits.Selected.'Positive Feedback' & "</td>
        <td style='text-align:center;'>" & galAllAudits.Selected.'Opportunity Feedback' & "</td>
    </tr>
</table>
</body>
"
 
PDF Test Button: 
ForAll(Filter(galAllAudits.AllItems,Checkbox3.Value) As AUDITPDF, PDFTest.Run(HtmlText3.HtmlText))
 
Kristi2_1-1715923141422.png

So if I were to select the PDF Test button with the screenshot above, it would only run my flow for the Merry Pippin item in the gallery two times. The flow is working as it should otherwise, which makes me think it's something in Power Apps. I'm hoping it's just some funky formula for the PDF Test button, but any help would be appreciated!

Categories:
I have the same question (0)
  • Wade_Wilson Profile Picture
    39 on at

    I think your HTML label is not not having multiple selected values from your gallery

     

    My suggestion is to write HTML in compose action in flow and pass all the required parameters from app into the flow and use dynamic values by creating parameters for all your required field to make pdf.

     

    Also use collection to collect selected items from gallery,

    onCheck of your check box:

     

    Collect(
          collectioName,
         {

           FieldName: ThisItem.ID

            //Add mode fields if needs.

         }
    )

    To remove/unselect items from Collection,

    onUncheck of check box,

     

    Remove(
    collectioName,
    LookUp(
    collectioName,
    Fieldname = ThisItem.ID
    )
    )

     

     

    you pdf button formula should be look kinda like this:

     

    ForAll(collectioName , PDFTest.Run(Field1,Field2,Field3,Field4,Field5....))
     
     
     
    Accept this as solution ✔️  if this approach worked for you.
     

     

  • Kristi2 Profile Picture
    12 on at

    Thank you @Wade_Wilson 

     

    The oncheck and onuncheck options for the button are as follows:

    OnCheck: Collect(colData,ThisItem)

    OnUncheck: RemoveIf(colData, ID = ThisItem.ID)
    And that's how I'm getting the total count, and also have the Check All option to check and uncheck everything in the gallery, so it seems to be functioning appropriately. I figured it must be something in my HTML or Button. I changed the OnSelect on the button to be: 
    ForAll(colData, PDFTest.Run(HtmlText3.HtmlText))
     
    Unfortunately, that still is only running the selected item in the gallery multiple times instead of running it for each item with a checkmark in the gallery. The HTML is written in a HtmlText item so I can preview the PDF in PowerApps, which is why the button is just saying to run the HtmlText3. Can you describe more what you're saying to do with the HTML? You're saying to put all of the HTML into the Flow instead of in the PowerApp? I have only had instances where I've had HTML in the PowerApp so any assistance or references for how to put it in the Flow would be appreciated. Thanks so much!
     
  • Verified answer
    Wade_Wilson Profile Picture
    39 on at

    Hey @Kristi2  Your CheckBox formula looks correct 

     

    I was wondering how your HTML label is going to render all the values from each record in `colData` when passing it to the flow. Since you are getting data from `galAllAudits.Selected` for the HTML label, it will only return a single record from `galAllAudits` (specifically, the last selected record from the checkbox). This seems to be why you are not getting all the selected PDFs.

     

    My suggestion is to put all the HTML formatting in a Compose action within your PDF flow. Pass all the values from `colData` by making it a parameter from the flow trigger and then use them dynamically in the HTML of the Compose action. This way, you won't need to remove the HTML label from the app, as you mentioned you are using it for preview.

     

    For Ex.

     

     

    Create parameters in flow:

     

    1Untitled.png

     

     

    Bind data in HTML:

     

    Untitled.png

     

     

     

     

     

    Let me know if its worked.

     

    If it did please accept it as solution and give it a thumbs up👍 so others can get help in the community.

     

  • Kristi2 Profile Picture
    12 on at

    @Wade_Wilson Thank you so much! I'm just running into one issue maybe you'd be familiar with, otherwise it's working like a champ! So I added in all of the parameters and created the HTML compose with all of the parameters:

    Kristi2_0-1716263791397.pngKristi2_1-1716263831420.png

    On the button in Power Apps I've updated it with the new flow and called out all of the parameters as well. The issue is I'm getting the attached error because of the Audit Date, which is included in the File Name so I need that date in there. The Audit Date is defaulted to "Today's Date" in the list for the Power App, but it's not a field they can select in the front end of the app. Do you know of any way to change the format to match what Power Automate needs? I tried to Google and Chat GPT it but not getting very far with it.

     

    But when I take out the Audit Date and just have Text as a Parameter, it does work so I'm selecting what you suggested as the solution 🙂 Thanks so much!

     

    Screenshot 2024-05-20 2200.png
  • Wade_Wilson Profile Picture
    39 on at

    Hello @Kristi2 

     

    I'm thrilled to hear that my solution was able to help you out! It's always great to know that I could make a positive impact.

    Regarding the issue you're facing now, 

     

    You can simply change the parameter type to text instead of date and time, then directly pass it as a string from Power Apps to Power Automate.

    Additionally, since you mentioned that the Audit Date corresponds to the date of PDF creation, you can utilize the `date` function within your HTML in Power Automate. You can achieve this by using utcnow() and formatting it as per your requirement.

     

    // as an example, the result could be '2022-03-15'
    formatDateTime(utcNow(),'yyyy-MM-dd')

     

    Thanks

     

     

  • Kristi2 Profile Picture
    12 on at

    @Wade_Wilson again, super helpful! I did a little bit more Chat GPT because some of this was going over my head. I ended up doing as you said and changed the Parameter to Text in the flow. Then on the button in the Power App I added the following before the ForAll: 

     

    Set('Audit Date', Today());
    Set(formattedDate, Text('Audit Date', "yyyy-mm-dd"));
     
    I wasn't sure how it would turn out, but it kept the mm-dd-yyyy format for the PDF and the file name, somehow haha sometimes I don't understand how things work but it did, and still passed through to Power Automate and is running the flow perfectly. Thank you so very much! 

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Leaderboard > Power Apps

#1
wolenberg_ Profile Picture

wolenberg_ 119 Super User 2026 Season 1

#2
WarrenBelz Profile Picture

WarrenBelz 107 Most Valuable Professional

#3
Haque Profile Picture

Haque 103

Last 30 days Overall leaderboard