0

Transfer all info on table to another table (script don't work)

let me := this;
let myA := first(select 'wbs by Documents' where 'Name Document' like me.'Name Document');
if myA = null then
    if dialog(" Waiting Answer", " Document NOT found.  ¿Include it now ??", ["Yes", "CANCEL"]) = "Yes" then
        for loop1 in select 'Bach Documents' do
            let newA := (create 'wbs by Documents');
            newA.('Name Document' := me.'Name Document');
            newA.(Hours := me.Hours);
            alert(" The Document has been INCLUDED..")
        end
    else
        alert(" The document was not created, it is DUPLICATED ")
    end
else
    alert(" The Document already exists It cannot be INCLUDED.")
end

I need to copy all Documents on  'Bach Documents' to 'wbs by Documents' but The script don't work.

7 replies

null
    • Fred
    • 10 mths ago
    • Reported - view

    is one of the if statement returning the wrong answer?

    or is the for loop part not working?

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

      Fred the bucle tranfer the first Document three times, the other two do not tranfer them.

    • Fred
    • 10 mths ago
    • Reported - view

    The loop part is working fine. There are three records in the 'Bach Documents' table and it creates three records in the 'wbs by Documents table.

    Ninox is naming all the new records the same name as the current record you are on.

    newA.('Name Document' := me.'Name Document')
    

    Notice you are using the me variable and that points to the current record. What do you think you should change that to?

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

       😣 I don't know what need to change

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

       Ready Thanks Fred. 👍

      • Fred
      • 10 mths ago
      • Reported - view

       When you get a chance, please explain what you did so others can learn from this post.

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

      Fred This script works perfect, and Add the 5 Date Plan. 

      If you can do better works appreciate 👍 A year with Ninox and I still have a hard time 😞

      let me := this;
      let myA := first(select 'wbs by Documents' where 'Name Document' like me.'Name Document:');
      if myA = null then
          if dialog("Waiting answer", "Document NOT found.  ¿Include now  ??", ["Yes", "CANCEL"]) = "Yes" then
              for i in (select 'Batch Documents') order by 'Name Document:' do
                  let newRec := (create 'wbs by Documents');
                  newRec.('Name Document' := i.'Name Document:');
                  newRec.(Hours := i.'Hours:');
                  newRec.('Plan_1 Editable' := i.Plan_1);
                  newRec.('Plan_2 Editable' := i.Plan_2);
                  newRec.('Plan_3 Editable' := i.Plan_3);
                  newRec.('Plan_4 Editable' := i.Plan_4);
                  newRec.('Plan_5 Editable' := i.Plan_5)
              end
          else
              alert("The document was not created, it is duplicated")
          end
      else
          alert("The Document already exists It cannot be INCLUDED.")
      end

Content aside

  • Status Answered
  • 10 mths agoLast active
  • 7Replies
  • 85Views
  • 2 Following