0

Help with "do as server" script

Hi all,

I have a button with code to create a number of records to a subtable...

The code is:

---

let reply := dialog("Confirmation!", "I will create " + '# of Payments' + " records, with Bill Data.
Continue?", ["Create", "Cancel"]);
if reply = "Create" then

...rest of the script

---

The above code working fine but it's a bit slow in the web app.

So I tried:

---

if ninoxApp() = "web" then
do as server

let reply := dialog("Confirmation!", "I will create " + '# of Payments' + " records, with Bill Data.
Continue?", ["Create", "Cancel"]);
if reply = "Create" then

...rest of the script

---

This code accepted but does nothing.

Is there some limitation in this senario?

Thanks

3 replies

null
    • Support
    • 4 yrs ago
    • Reported - view

    It should be
    –––
    let reply := dialog("Confirmation!", "I will create " + '# of Payments' + " records, with Bill Data.
    Continue?", ["Create", "Cancel"]);
    if reply = "Create" then
    do as server
    ...rest of the script
    end
    –––

    The dialog() function has to be called on the client!

    Birger

    • Nick
    • 4 yrs ago
    • Reported - view

    Thanks Birger!

    • Nick
    • 4 yrs ago
    • Reported - view

    Well, without the "do as server" step, takes about 40 seconds to create 20 records to a subtable (approximately 2 seconds per record).

    With the  "do as server" step in the script, 50 records created almost instantly...

     

    Yeah! :-)

Content aside

  • 4 yrs agoLast active
  • 3Replies
  • 1534Views