1

Trigger after update record not triggered when linking/adding records to sub-table

I don't know if this is a bug or a feature, but the Trigger after update is only triggered when editing data in normal fields. Any change in a sub-table does not trigger the script. Is there any trick?

Of course, I've added a button that the client can press to manually trigger the scripts, but they can easily forget to clic the button anytime they make changes to sub-tables...

4 replies

null
    • Ninox partner
    • RoSoft_Steven.1
    • 2 yrs ago
    • Reported - view

    You can use the trigger After hide of the tab element in your child table. If you don't have a tab element, you can add one in the first position where you can set up the trigger.

    • John_Halls
    • 2 yrs ago
    • Reported - view

    Hi Javier

    The Trigger after update: has to be on the updated table or field. So if you had a Trigger on update: at the table level of the parent

    if sum((child).total) = 0 then
    status := "out of stock"
    end
    

    but the figures are being updated in the child table, the Trigger after update: actually needs to be at the table level of the child

    if sum((parent.child).total) = 0 then
    parent.status := "out of stock"
    end
    

    Regards John

    • Consultant and developer
    • Javier
    • 2 yrs ago
    • Reported - view

    John Halls Great! Also, your example gave me the clue I needed! So, just by placing an array formula (sum, average, first, last, etc) in a field is enough to trigger the after update in the child table.

    It's not intuitive, but makes sense (the parent table is not changing, only the "view" of the child table). I need to think as Ninox thinks, and then everything else begins to make sense.

    Thanks again, John Halls

      • John_Halls
      • 2 yrs ago
      • Reported - view

      Javier You are right in that the parent is not changing, the view. It's not the sum function that's causing the trigger. Triggers only ever happen when you go into a field and make a change to the data.

Content aside

  • Status Answered
  • 1 Likes
  • 2 yrs agoLast active
  • 4Replies
  • 261Views
  • 4 Following