0

Need Script for transfer Dates

Hi Fred again with problems, I feel like I'm. going backwards.

On the Documents I have Two Buttons ADD  Documents  One by One and the other ADD ALL Documents and Works excelent.

Now I need to Copy from 'Control Deliverables'  to 'News Forecast Dates' all dates Real 1 to 5  and all dates Plan 1 to 5 on OldPlan 1 to 5

On 'Control Deliverables' I have a Button name Forecast Days Re-Planning with the script.

Can you help me.

5 replies

null
    • Rafael Sanchis
    • Rafael_Sanchis
    • 3 wk ago
    • Reported - view

    There are any way to do this 

    • Fred
    • 3 wk ago
    • Reported - view

    I did a test and found this works:

    newR.(
            'Control Deliverables_>' := me;
            Name_Document := me.'Name Document';
            'Forecast 1' := me.'Real 1';
            'Real 1' := me.'Real 1'
        )
    

    You don't need to create all those variables since you have the 'me' variable already.

    Give this a try and if works for you then just expand it.

      • Rafael Sanchis
      • Rafael_Sanchis
      • 3 wk ago
      • Reported - view

       

      hi Fred, 

      let xResponse := dialog(" ADD Real Dates To Forecast Table ", "Do you want to ADD Real Dates To Forecast Table for Re-planning ?", ["Yes", "CANCEL"]);
      if xResponse = "Yes" then
          let me := this;
          let newR := (create 'News Forecast Dates');
          newR.(
              'Control Deliverables_>' := me;
              Name_Document := me.'Documents_>';
              'Forecast 1' := me.'Real 1';
              'Forecast 2' := me.'Real 2';
              'Forecast 3' := me.'Real 3';
              'Forecast 4' := me.'Real 4';
              'Forecast 5' := me.'Real 5';
              'Real 1' := me.'Real 1'
          )
      end
      

      Is ok I need to do one change on line 7 and works perfect, now I need to copy all register 👍

      • Rafael Sanchis
      • Rafael_Sanchis
      • 3 wk ago
      • Reported - view

       

      Hi Fred. 

      let xResponse := dialog(" ADD Real Date To Forecast Table (one by one) ", "Do you want to ADD Real Dates To Forecast Table for Re-planning ?", ["Yes", "CANCEL"]);
      if xResponse = "Yes" then
          let me := this;
          let newR := (create 'News Forecast Dates');
          newR.(
              'Control Deliverables_>' := me;
              'Documents_>';
              'Old Plan 1' := me.'Plan 1';
              'Old Plan 2' := me.'Plan 2';
              'Old Plan 3' := me.'Plan 3';
              'Old Plan 4' := me.'Plan 4';
              'Old Plan 5' := me.'Plan 5';
              'Forecast 1' := me.'Real 1';
              'Forecast 2' := me.'Real 2';
              'Forecast 3' := me.'Real 3';
              'Forecast 4' := me.'Real 4';
              'Forecast 5' := me.'Real 5';
              'Real 1' := me.'Real 1';
              'Real 2' := me.'Real 2';
              'Real 3' := me.'Real 3';
              'Real 4' := me.'Real 4';
              'Real 5' := me.'Real 5'
          )
      end
      

      The Scrip work perfect to transfer  one by one, now I need to transfer all Records.

      I will try insert 

      for s in select 'Control Delivery' do
              let newR := (create 'News Forecast Dates');
              newR.(
                  'Documents_>' := s;
      

      But don't work, copy all 'Name Document' ok,  but the Dates no only copy the firts and repeat on all documents.

      • Fred
      • 3 wk ago
      • Reported - view

      remember you are now inside a for loop, so your me variable (which is linked to this) will link all of your record to this one record. You need to change your references from me to s.

Content aside

  • Status Answered
  • 3 wk agoLast active
  • 5Replies
  • 68Views
  • 2 Following