0

Move record.

Is it possible to move a record to another table depending on a selection field ie yes.  And remove from original table. 

Thank you. 

6replies Oldest first
  • Oldest first
  • Newest first
  • Active threads
  • Popular
  • Alan, Create a new database with two tables named: Table1 and Table2. Include two text fields named: firstname and lastname (in both tables). Add a 'Yes / No' field with the default name to Table1. Create sample records in Table 1. Select "Yes" in one or more of the records. Then add the following code to a "Move Records" button in Table1:

    for i in select Table1 where 'Yes / No' = true do
      let k := i.this;
      let f := i.firstname;
      let l := i.lastname;
      delete (select Table1 where Id = k);
      let t := (create Table2);
      t.(firstname := f);
      t.(lastname := l)
    end

    Like
  • Glad Alan asked the question, was wondering the same. THANK YOU Dean (for your answer !! :-))

    Like
    • Faldo
    • Faldo
    • 2 yrs ago
    • Reported - view

    Thanks Dean will try that today.  I was going down the rout of another view or filter or something but that sounds great 

    Karen great to think there's more than me scratching our heads. 😂😂

    Like
    • Faldo
    • Faldo
    • 2 yrs ago
    • Reported - view

    Wow just tried it and brilliant thanks again Dean

    Like
  • If you want user to end up viewing destination table, you could add two more lines:

     

    openTable("Table2");
    alert("Records with ""Yes"" have been moved to Table2")

    Like
    • Faldo
    • Faldo
    • 2 yrs ago
    • Reported - view

    Brillaint keep them coming :0

    Like
Like Follow
  • 2 yrs agoLast active
  • 6Replies
  • 481Views