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

ForAll to produce PDF pages

Hi,

 

Really hoping this is something obvious I can't fathom why it doesn't work.

 

So I want to produce a pdf with 97 rows in a html table, using the html text control. Page breaks don't exist so you get the cut off half way through a row. So I created a gallery that gets filtered  by looking at the max Page Start and Page End of the created PageNumbers table, then want to call a flow each time it gets filtered to produce individual pdfs of 15 items per run to avoid the page break issue.

 

I've got so far through this with the following:


Clear(coll_PageNumbers);
 
Run through Numbers table (this is a table produced to say how many times to pass. Then produce Page Numbers Table for item 15 onwards
 
ForAll(coll_Numbers,
      
       Collect(coll_PageNumbers,
       Last(FirstN(AddColumns(coll_Numbers,
       "PageStart", ((CountRows(coll_PageNumbers)+1)*15),
       "PageEnd", ((Number+1)*15),
       "QuoteID", "Quote-" & txtQuoteID_1.Text & "-" & Number),
       
       Call Flow to produce pdf
       v2QuotationMakePDF.Run(HTML_Template_NH.HtmlText, "Quote-" & txtQuoteID_1.Text & "-" & Number);
      
       CountRows(coll_PageNumbers)+1))));
 
I can see it filtering the gallery as it runs through but it only calls the flow for the last filtered page? What am I doing wrong?
 
Thanks
 
Francis
 
1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Super User II
Super User II

Re: ForAll to produce PDF pages

@flogan2000 

I've always found the PowerApps --> Flow --> OneDrive PDF very limiting. There's a lot you cannot do.

 

Try using Encodian (link: https://support.encodian.com/hc/en-gb). They have a small use/Flow volume free version which may do what you need.

 

Theres also Muhimbi PDF and Plumsail but these might be overkill for what you need.

View solution in original post

7 REPLIES 7
Highlighted
Super User III
Super User III

Re: ForAll to produce PDF pages

Hi @flogan2000 ,

I am not sure I have the solution presently, but how does the HTML text relate to colPageNumbers as far as its content goes each time you loop through as this is what the flow will send.

Highlighted
Super User II
Super User II

Re: ForAll to produce PDF pages

@flogan2000 

I've always found the PowerApps --> Flow --> OneDrive PDF very limiting. There's a lot you cannot do.

 

Try using Encodian (link: https://support.encodian.com/hc/en-gb). They have a small use/Flow volume free version which may do what you need.

 

Theres also Muhimbi PDF and Plumsail but these might be overkill for what you need.

View solution in original post

Highlighted
Frequent Visitor

Re: ForAll to produce PDF pages

Thanks will take a look.

Highlighted
Frequent Visitor

Re: ForAll to produce PDF pages

Hi Warren,

 

The process I've built uses a numbers table of 100 rows in SharePoint, this is then filtered and put in a collection 97 rows in my quote table divided by 14 items that would fit on the pdf.

 

The PageNumbers table works out what the first page is ie 1 and then end page 15, 15 then 29... Each time the row is inserted into the table two text boxes take the start and end max numbers which filter the gallery. The gallery feeds into the html doc.

 

So in essence what should happen is each time page start and end are generated the gallery filters, the html is populated and the html is sent to Flow for each page.

 

I'm sure it's probably the positioning of my Run command in the ForAll, or need some nesting etc but can't see what it stopping it working.

Highlighted
Super User III
Super User III

Re: ForAll to produce PDF pages

Hi @flogan2000 ,

I am a bit with @Eelman on this - it is really a workaround (you get a lot of these in Power Apps) using external facilities (Flow and OneDrive). However what you are doing is adventurous and you might just be able to get it to work.

You are also relying on the HTML variables to resolve and refresh the text before the next loop in the ForAll hits it again and takes the content.

To prove this (or not), you might consider putting in two text boxes for the page numbers and use Value(PageFrom) and Value(Page2) in your formula, get rid of the ForAll then run it to see if you get the right pages each time. Another thing you can do in testing is putting a timer in the loop somewhere and do a Notification before it telling you what page numbers have just been produced. On that subject, if this is refresh issue, a Timer might be the answer.

 

Highlighted
Frequent Visitor

Re: ForAll to produce PDF pages

Thanks, will test a timer and let you know. I have the text boxes already it's the html that's not picking the filtered gallery. I may need to resort to clicking the button each time to produce each page, (only 5 pages each pdf), bit clunky but at least would work.

Highlighted
Frequent Visitor

Re: ForAll to produce PDF pages

Couldn't get the timer to work, so have gone with context variable for page number, this then does a lookup to find items 1-15, then adds 1 to the page number, click button again, look up next set of items, keep click till complete. Would be so much easier if you could put a variable in a loop. Thanks for your help anyway, I think long term it could go via the 3rd party connector for produce PDF from html so will mark as solution.

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Come join us today! Find your favorite faces from the community presenting at the Power Platform Community Conference!

Watch Now

Experience what’s next for Power Apps

See the latest Power Apps innovations, updates, and demos from the Microsoft Business Applications Launch Event.

Power Platform ISV Studio

Power Platform ISV Studio

ISV Studio is designed to become the go-to Power Platform destination for ISV’s to monitor & manage published applications.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (3,643)