0

Code funktioniert plötzlich nicht mehr

Ich habe aus einer Tabelle Daten zu exportieren und in eine PDF zu schreiben die als Einsatzreport dann ausgedruckt wird. Dazu hatte ich eine Routine geschrieben die dezidiert einen bestimmten Zeitbereich (immer vom 21 des vorherigen Monats bis 20 des aktuellen Monats, Startperiode und Endperiode haben das Datum), abbildet und in einer Tabelle in die PDF schreibt. Hat bisher wunderbar funktioiert. Plötzlich funktioniert das nicht mehr und ich kann nicht herausfinden woran das liegt:

hier der Code

let heute := today();
let start := date(if month(heute) = 1 then year(heute) - 1 else year(heute) end, if month(heute) = 1 then 12 else month(heute) - 1 end, 21);
let ende := date(year(heute), month(heute), 20);
this.(Startperiode := start);
this.(Endperiode := ende);
alert("Zeitraum gesetzt und Report erzeugt: " + format(this.Startperiode, "DD.MM.YYYY") +
" bis " +
format(this.Endperiode, "DD.MM.YYYY"));
let myFileName := ClientNameFull + "_Report_" + "_for_" + 'For the Month of' + "_issued_" +
    format(if 'issued date' then 'issued date' else today() end, "YYYY-MM-DD") +
    "_" +
    ".pdf";
importFile(this, printAndSaveRecord(this, "Report"), myFileName);
CreportPDF := myFileName;
BerechnetBis := today();
printRecord(this, "CreportPDF") 

Hat jemand eine Ahnung? Wenn es noch mehr Info braucht, einfach fragen. Ich wäre sehr glücklich über eine Lösung

4 Antworten

null
    • Ninox Partner
    • RoSoft_Steven_Rooryck
    • vor 2 Tagen
    • Gemeldet - anzeigen

    Does your filename have special characters? Ninox is having issues with accents or other characters in filenames...

      • geschäftsführer
      • Talent_Solution_mk
      • gestern
      • Gemeldet - anzeigen

       there is no special characters at all, i wrot the Code new and sudently it works again. Here is the new Code:

      let dt := today();
      let m := month(dt);
      let y := year(dt);
      let start := date(if m = 1 then y - 1 else y end, if m = 1 then 12 else m - 1 end, 21);
      let ende := date(y, m, 20);
      let einsaetze := (select Shiftlist where 'Date-of-Shift' >= start and 'Date-of-Shift' <= ende);
      alert("Report für den aktuellen Kunden erstellt: " + einsaetze);
      let pdf := printAndSaveRecord(this, "Report", einsaetze);
      let myFileName := ClientNameFull + "_Report_" + format(dt, "YYYY-MM-DD") + ".pdf";
      importFile(this, pdf, myFileName);
      ReportPDF := myFileName;
      BerechnetBis := dt

      but i cant write the Report into a textfield again.

    • Ninox Partner
    • RoSoft_Steven_Rooryck
    • gestern
    • Gemeldet - anzeigen
     said:
    but i cant write the Report into a textfield again.

     Your code saves the pdf in the attachments tab? You can use a formula field to show this pdf: last(files(this))

    You can write a pdf in an image-field, not in a textfield.

    • geschäftsführer
    • Talent_Solution_mk
    • vor 11 Stunden
    • Gemeldet - anzeigen

    Sure its not the same Code, the Code for the Textfield who not run is:

    let dt := today();
    let m := month(dt);
    let y := year(dt);
    let start := date(if m = 1 then y - 1 else y end, if m = 1 then 12 else m - 1 end, 21);
    let ende := date(y, m, 20);
    let currentCustomer := this.Shifts.ClientShifted;
    let einsaetze := (select Shiftlist
            where 'Date-of-Shift' >= start and 'Date-of-Shift' <= ende and
            ClientShifted = currentCustomer);
    let text := "";
    for e in einsaetze do
        let datum := if e.'Date-of-Shift' != null then
                format(e.'Date-of-Shift', "DD.MM.YYYY")
            else
                ""
            end;
        let service := if e.'Service done' != null then
                e.'Service done'
            else
                ""
            end;
        let stunden := if e.DurationInZeitwert != null then
                "" + e.DurationInZeitwert
            else
                ""
            end;
        let cleaner := if e.'Cleaner Name' != null then
                e.'Cleaner Name'
            else
                ""
            end;
        text := text + datum + ", " + currentCustomer + ", " + cleaner + ", " + service + ", " +
            stunden +
            "
    " +
            "test2
    "
    end;
    CReportForInvoicing := text;
    BerechnetBis := dt;
    alert("Einsätze für Invoicing wurden ins Textfeld geschrieben: " + cnt(einsaetze))

Content aside

  • vor 11 StundenZuletzt aktiv
  • 4Antworten
  • 42Ansichten
  • 2 Folge bereits