0

Activate or Deactivate all records in a "Yes/No" field

How can activate or deactivate all records in a "Yes/No" field.

The Table is 'Control Deliverables' and the name 'Yes/No' field is Protect.

5 replies

null
    • Ninox partner
    • RoSoft_Steven.1
    • 5 mths ago
    • Reported - view

    Did you try the "Bulk edit..." ?

    • Alan_Cooke
    • 5 mths ago
    • Reported - view

    I have this script to lock all records in the Projects table.
    Under a button to unlock.
    do as server
        for i in (select PROJECTS)[LOCKED = true or LOCKED = null] do
            i.(LOCKED := false)
        end
    end;
    alert("All records unlocked")

    Under a button to lock
    do as server
        for i in (select PROJECTS)[LOCKED = false or LOCKED = null] do
            i.(LOCKED := true)
        end
    end;
    alert("All records locked")

    I have also set 'display as' so that each button is only displayed based on the locked/unlocked condition.  That way when locked the locked button is hidden and the unlock button is displayed and vice versa.  The Yes/No field is always on display so that I can unlock/lock an individual record.

     

    Hope that helps. 
     

      • Rafael Sanchis
      • Rafael_Sanchis
      • 5 mths ago
      • Reported - view

       Thanks Alan 👍 

      • Alan_Cooke
      • 5 mths ago
      • Reported - view

       You are welcome.  I use these icons for the button

      🔒, 🔓- How?  If you have a Windows OS then Windows Key + ; does the trick.

    • John_Halls
    • 5 mths ago
    • Reported - view

     Another approach would be to set the Binding of your Protect field to 'Global variable in memory (browser)'. It then has a single value for all your records. Its initial state is set by the 'Default value'. To set this with a script, its just

    let a := record('Control Deliverables',1);
    a.Protect := true

    Regards John

Content aside

  • Status Answered
  • 5 mths agoLast active
  • 5Replies
  • 39Views
  • 4 Following