0

Need transfer only the Approved.

I am using this table for the documents that will be incorporated into the main Documents table  as scope changes, will not be included in the main table until the scope change is approved by the client.

I included a choice field where I have the option of Approved, To Approve, & Potential, and I would like to design a script that once approved the Change Order transfer only the Approved.

What would be the best option, since although the example has only 4 documents, it is possible that the scope changes could have a large number of documents.

The Scrip I have transfer ALL Documents and work but need transfer only the Approved.

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 💻 on 'wbs by Documents'?", ["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

4 replies

null
    • Fred
    • 11 mths ago
    • Reported - view

    My guess would be editing line 5:

    for i in (select 'Batch Documents' where text(Statusfield) = "Approved") order by 'Name Document:' do
    
      • Rafael Sanchis
      • Rafael_Sanchis
      • 11 mths ago
      • Reported - view

      Hi Fred don't work, I try it but does not transfer anything.

    • Fred
    • 11 mths ago
    • Reported - view
     said:
    but does not transfer anything.

    Did you check to make sure there are records that match the requirements?

    You can put this in a formula field:

    concat(select 'Batch Documents' where text(Statusfield) = "Approved")
    

    If it shows no records then you need to check your records to make sure some of them meet the requirements.

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

      Fred works Fred Sorry forget the  "✅ Approved" 👍

      Thanks 

Content aside

  • Status Answered
  • 11 mths agoLast active
  • 4Replies
  • 60Views
  • 2 Following