0

Trigger after update not triggered when updating by copy&paste

I have a table with code for trigger after update (for the table, not a field).

When I edit an existing record by typing in a field, the trigger gets called as expected. When I use copy & paste to copy data from one record to another, the trigger does NOT get called, although the record gets updated.

This looks like a bug to me. If intended behavior, what is the motivation, and how can I make Ninox call the trigger for any update, including update by copy&paste?

8 replies

null
    • John_Halls
    • 2 mths ago
    • Reported - view

    Hi  Works as expected for me. Don't forget you have to move the focus away from the field for the trigger to take effect.

    Can you share your trigger?

      • Fred
      • 2 mths ago
      • Reported - view

        I, too, was not able to reproduce your problem.

      • dennis
      • 2 mths ago
      • Reported - view

       I can confirm this still happens, also after moving focus to a different row.

      let m := this.Meta;
      let s := (select metas where meta = m);
      metas := first(s)
      

      This is the code under "Trigger after update" (for whole table). It takes the value of the text field "Meta" in the current table and looks it up in a different table "metas" (the field name in that table is "meta"), then sets the field "metas" of the current table (which is a relationship field) to the record that was found, or null if none was found.

      The code works when I manually enter text into Meta. When I copy and paste text from another row, nothing happens.

      By the way, I'd write "where metas.meta = m" to make it clearer to read, but Ninox doesn't allow that syntax.

      • Mel_Charles
      • 2 mths ago
      • Reported - view

       doing a quick replication of your table and fields. and your script. The trigger event works for me works for my except and with your script as is then I return a "false" in Metas in the main table. Even though the text exists in Metas table

      and ninox alters your script to (adds the brackets)

      As this is a table trigger then if I were to edit a cell elsewhere on the form then the trigger will fire possibly before I require it.

    • Fred
    • 2 mths ago
    • Reported - view

    I tried it again using a table Trigger after update (because I didn't read your original post thoroughly), though (imho) it seems like better served with a field level trigger. And the only time it didn't work was if I created a new record in the table view and then pasted the data. Otherwise, with a record that is already there, if in a table view I double click in a cell and paste then clicked the enter key the reference field is properly updated.

    I used your code, just slightly modified for my test DB:

    let m := this.meta;
    let s := (select Table2 where meta = m);
    Table2 := first(s)
    
      • dennis
      • 2 mths ago
      • Reported - view

       Thank you! In my case (Ninox DB app on Mac) it fails whenever I copy & paste that one field, regardless of whether the record it gets pasted in is newly created or existing.

      So the behavior is different, but still you were able to reproduce this. You said "the only time it didn't work" - it should actually work every time. So it's a bug.

      • Mel_Charles
      • 2 mths ago
      • Reported - view

      in that case Dennis you will need to send an email to support@ninox.com and copy your info placed here to show them.

      • Fred
      • 2 mths ago
      • Reported - view

       In my case (Ninox DB app on Mac) it fails whenever I copy & paste that one field

      With this new info, I went back and tested in my app on the Mac. It does fail like you reported if working on a local or iCloud DB.

Content aside

  • 2 mths agoLast active
  • 8Replies
  • 91Views
  • 4 Following