0

dialog - causes text field "trigger after update" to fail

I have debugged this trigger event line by line and the result is ..... it hates the use of "dialog". I have a need to ask for a Yes/No within the trigger event. Taking this ONE LINE out of the code allows the code to trigger (proved using alert() as first line) and all is well, but leave it in place and there's no event trigger at all.

ans := dialog(dialogtop, dialogtext + text(v), ["yes", "no"]);

I have tried:

  • substituting strings for the yes/no
  • starting with an undeclared variable using  let....
  • removing the included text(variable)
  • changing predefined text into quoted text
  • .....everything

...sadly, on each iteration the whole code block fails to run.

Are other users facing this problem?
Is this already documented?
Any ideas...please.

PS: If I put the code (unchanged) in a button, then it works fine.......I just don't want the button!!!

Version: Local Database (no Cloud) Mac App. v3.17.4

Thanks, as ever.
Graham

8 replies

null
    • Keeping the grey cells active…..at 70+
    • Graham
    • 2 wk ago
    • Reported - view

    SELF ANSWERED...

    Sorry guys......chatGPT tells me that this is a known "gotcha" due to effectively pausing an update cycle. So in future, no dialog boxes in triggers! 

    • Fred
    • 2 wk ago
    • Reported - view

    Take a look at this page. It shows you where actions happen in Ninox by default.

    If your DB is stored locally,, then a dialog should always work.

    I noticed that you don’t have a let in front of ans. Maybe this is why.

      • Ninox developper
      • Jacques_TUR
      • 2 wk ago
      • Reported - view

       is right: in Ninox, the onUpdate trigger script for a Cloud application runs on the server. It’s exactly as if you were using a Do As Server in a button’s code; the Alert and Dialog functions would not work and might even cause a runtime error.

      • Keeping the grey cells active…..at 70+
      • Graham
      • 2 wk ago
      • Reported - view

       - Thanks Fred - I had actually used let and no-let -  but  solved this one for me. A really useful tip.

    • John_Halls
    • 2 wk ago
    • Reported - view

    dialogue doesn't work in a trigger, but does in a button. Triggers don't have to have a user in front of the screen (zapier can add a record and the Trigger on new record will fire), but a button requires a user to click it and so is guaranteed (pretty much) to have a user present.

    Regards John

      • Ninox Widgets & User Interfaces
      • Jakob_Jordan
      • 2 wk ago
      • Reported - view

       actually trigger after update can show dialogues and alerts. You just have to set the Binding to "Per record in memory (browser)". Its how we solve delete dialogues and more for our widgets (that use database.update()).

    • Keeping the grey cells active…..at 70+
    • Graham
    • 2 wk ago
    • Reported - view

    I will try this - and thank you all for responding. 
     

      • Keeping the grey cells active…..at 70+
      • Graham
      • 2 wk ago
      • Reported - view

      Jakob - BRILLIANT! - Thank you so much. The field now works as I would like it to and has allowed my to get rid of a slightly unnecessary button.

Content aside

  • Status Answered
  • 2 wk agoLast active
  • 8Replies
  • 50Views
  • 5 Following