Multiple records print with button
Hi,
Is there a way to print multiple pages (records) in a button ?
For one page, it already works with this :
let myPdf := printRecord(this, "name");
Actually, I can already do it with the print button in ninox and then select the "all" function but I would like to do it in a button.
Thanks a lot.
Lorenz
27 replies
-
Hello,
Does someone know how I cloud do this ?
Thanks for your support.
Lorenz -
Hi Lorenz,
this is possible if you iterate with a for loop.
Best regards, Alex
-
Hi Lorenz,
it should be able to do that with the same formula but in a loop:
for i in select table where fieldA = "AB" do
printRecord(this,"name")
end
Best, Jörg
-
Hi Support,
With your suggestion there will be printed a lot of PDF (one per record). With the "Tout" (see the image above) they will be ALL printed in UNIQUE pdf. How it is possibile to reproduce this by usign a button/formula?
-
I'm also interested if anyone has any idea how to combine multiple pdf's into one
-
With Ninext (https://forum.ninox.com/t/p8h78zv?r=g9ha3vf), you can do it :
var strThis := string(this.id); var Nids := (select myTable).string(id); var reportName := "myReportName"; var fileName := "myFile.pdf"; var link := #{:link:callback var config = { nid: strThis, nids: Nids, reportName: reportName, saveToFileAndClose: (err, file) => callback(err?err:file) }; return schemas.envConfig.openDesigner(config); }#; importFile( this, link, fileName)
Just change the parameters of lines 2, 3 and 4.
-
Sébastien Guillet said:
Unfortunately, I will not be able to use the dynamic reports because the 2 documents are an invoice and an appendix containing personal data. The invoice has page numbers and the appendix should not be part of this numbering because the appendix is a document that is not intended to be sent to mutual insurance companies (I work in health/well-being). If my client removes the second page (the appendix), the health insurance company will find that a page is missing and may request the second page believing that it is the rest of the invoice.I think that with a section break in Word, you can have your appendix printed without it appearing in the page numbering.
-
I updated last function and i ranmed it printAndSaveMutiRecord. Now it print and retrieve one URL link of the file. With this, link, you can decide to download it or save it to attached documents of record :
function downloadURL(urlFile : text,destFileName : text) do #{:text:callback fetch(urlFile) .then(resp => resp.blob()) .then(blob => { const url = window.URL.createObjectURL(blob); const a = document.createElement('a'); a.style.display = 'none'; a.href = url; a.download = destFileName; document.body.appendChild(a); a.click(); window.URL.revokeObjectURL(url); callback(url.url); }) }# end; function printAndSaveMutiRecord(strNids : text,reportName : text) do var n := split(replace(strNids, " ", ""), ","); #{:text:callback var config = { nid: n[0], nids: n, reportName: reportName, printAllAndClose: !0 }; var old = database.printRich; database.printRich = (e, t) => { old.call(database, e, (err, result) => { callback(database.loadFileURL(result.id, e.name, "application/pdf", !0)); }) database.printRich = old } schemas.envConfig.openDesigner(config); }# end; var urlFile := printAndSaveMutiRecord(concat((select Customer where 'First Name' like "S").string(Id)), "Kunde"); downloadURL(urlFile, "myFileName.pdf"); importFile(this, urlFile, "myOtherFileName.pdf")
Line 39 : the report is printed with several records and returns a URL link.
Line 41 : the link is used to download the file with a specific file name.
Line 43 : the link is used to attach the file to this record with the standard Ninox function, again with a specific file name.
note: in the previous version of printMultiRecord, asynchronous mode is not really supported and you can have problems if you call the function several times successively.
-
Please find an example of printing in the attached database. See the ViewEvent table.
Lots of news on this page:
- The customer list is retrieved from the 'Customer list' field. This means that the print button takes into account the filter and the order of the list.
- The download button asks for the name of the file before downloading it.
- and, of course, the print button allows you to print multiple records on the same report.
Content aside
- 2 mths agoLast active
- 27Replies
- 3078Views
-
5
Following