0

Best practice: Speeding up Ninox scripts

Hi there, 
I'm trying to backup my bookkeeping from sevDesk; so I first filled a ninox table with all the JSON Results from the sevDesk REST API.

Result is ~1900 Datasets

 

Now I want to split my Data from the JSON into specific fields.

Here's the script:

for r in select RohBelege do
    let jsonData := parseJSON(r.Data);
    if jsonData != null then
        r.(
            if jsonData.creditDebig = (= "C") then
                SummeNetto := -number(jsonData.sumNet);
                SummeTax := -number(jsonData.sumTax)
            else
                SummeNetto := jsonData.sumNet;
                SummeTax := jsonData.sumTax
            end;
            TaxRate := jsonData.sumTax;
            Lieferant := jsonData.supplierName;
            BelegDatum := jsonData.voucherDate;
            BezahlDatum := jsonData.payDate;
            BelegId := jsonData.id;
            if jsonData.document != null then
                DokumentId := jsonData.document.id
            end;
            Status := jsonData.status;
            Beschreibung := jsonData.description
        )
    end
end

I started it with a button click and now I can see ... every .... single .... field .... being ... updated .... step .... by .... step ... which .... takes ... forever.... (Running for 40 minutes now and not even half way done.)

Is it possible:
- To run the Script in BackEnd rather than frontend

- To update all fields of the Dataset at once (without writing every change to the DB as a single update)?

2 replies

null
    • szormpas
    • 8 days ago
    • Reported - view

     Hi, in general if we want to run the Script in BackEnd rather than frontend we use the 

    do as server ... end

    For more info, check out the documentation.

    Is this something that could work for you?

      • Frank_Wiebeler
      • 8 days ago
      • Reported - view

       Hi, yes that should work; will test it :) 

Content aside

  • 8 days agoLast active
  • 2Replies
  • 31Views
  • 2 Following