0

Locking Records in multiple tables from one

I have this script to lock records in a table.  How would I modify it to lock records in child tables related to this Projects table?  In other words lock Inventory and Locations

do as server
    for i in (select PROJECTS)[LOCKED = true] do
        i.(LOCKED := false)
    end
end;
alert("All records unlocked")

4 replies

null
    • Fred
    • 1 yr ago
    • Reported - view

    It looks like the script UNLOCKS, but maybe you have it the other way around.

    Using your provided code, you can try something like:

     for i in (select PROJECTS)[LOCKED = true] do
            i.(LOCKED := false;
                Inventory.LOCKED := false;
                Locations.LOCKED := false)
     end
    

    So all related records in Inventory and Locations will also be set to "false". The power of related records.

      • Alan_Cooke
      • 1 yr ago
      • Reported - view

      Fred Yes it is :-) One of a pair to lock unlock.

      Will give that a go thanks

    • Ninox developper
    • Jacques_TUR
    • 1 yr ago
    • Reported - view

    You can create a formula in each child table to reflect the state of PROJECT.LOKED.

      • Fred
      • 1 yr ago
      • Reported - view

      This would be an easier way, if you wanted the child records to always be in sync with the parent. But if need the ability to micro manage the lock state of each child record then your current method is the way.

Content aside

  • 1 yr agoLast active
  • 4Replies
  • 52Views
  • 3 Following