0

Rename a report when printing

Hello,

I have a button to print a report (printRecord(this, "Offer")). The report is named, for example, offer123. I would like this report to be named Offer # 123; Ref. Sking mag. I can't find a way to do this. I have tried a few scripts found here and there, without success.

2 replies

null
    • Ninox partner
    • RoSoft_Steven.1
    • 1 mth ago
    • Reported - view

    See this function: https://docs.ninox.com/en/script/functions-overview/functions/printandsaverecord

    Oh, BTW, One thing Ninox can't handle is punctuation in the filename

    • Mel_Charles
    • 1 mth ago
    • Reported - view

    Pascal

    Here is my example that changes the default name to a quote ref that matches the record number

    ie SQ9290.pdf

    if 'Draft!' then
        alert("Draft Quote Only Saved ! Turn Off Draft Flag To Print Final Quote!")
    else
        QuoteSentFlag := null;
        QuoteImage := null;
        let myP := if QImage1 or QImage2 or QImage3 or QImage4 then
                "118PrintQuotePics"
            else
                "118PrintQuote"
            end;
        let myPdf := printAndSaveRecord(this, myP);
        let myName := "SQ " + QteNum + ".pdf";
        importFile(this, myPdf, myName);
        QuoteImage := myName;
        ProdFlag := false;
        QuoteSentFlag := null
    end

     

    Note: I save all my print outs to an image field on the record

    also tests are done to see if QImage1, 2  etc fields contains an image, if so they are added to the final print out 

Content aside

  • 1 mth agoLast active
  • 2Replies
  • 36Views
  • 3 Following