0

Concatanate - Two For loop -

let check := dialog(" ATENCION ", " ¿Confirma el SETUP de la tabla de AVANCES_PROYECTO ? ", ["Si", "No"]);
if check = "Si" then
    for loop1 in select BASELINE do
        'Date:' := loop1.Data_Date;
        let xDoc := first(select EVM);
        let xFld1 := xDoc.'Progress Project';
        let xFld2 := xDoc.Week;
        let xFld3 := xDoc.DataDate;
        let i := (create PLAN_CURVE);
        i.(Base_PLAN := xFld1);
        i.(Week_PLAN := xFld2);
        i.(Date_PLAN := xFld3)
    end
else
    closeRecord()
end

After this loop1  I need other one loop, how can I do that.

15replies Oldest first
  • Oldest first
  • Newest first
  • Active threads
  • Popular
    • John Halls
    • John_Halls
    • 2 mths ago
    • Reported - view

    Loops can be arranged one after another, or nested one inside another. It all depends on your use case.

    Like
      • Rafael
      • Rafael Sanchis
      • Rafael_Sanchis
      • 2 mths ago
      • Reported - view

      John Halls 

      let check := dialog(" ATENCION ", " ¿Confirma el SETUP de la tabla de AVANCES_PROYECTO ? ", ["Si", "No"]);
      if check = "Si" then
          for loop1 in select BASELINE do
              'Date:' := loop1.Data_Date;
              let xDoc := first(select EVM);
              let xFld1 := xDoc.'Progress Project';
              let xFld2 := xDoc.Week;
              let xFld3 := xDoc.DataDate;
              let i := (create BASELINE_CURVE);
              i.(Base_PLAN := xFld1);
              i.(Week_PLAN := xFld2);
              i.(Date_PLAN := xFld3)
          end
      else
          closeRecord()
      end
          for loop1 in select 'CUTOFF-DATES' do
              'Date:' := loop1.Data_Date;
              let xDoc := first(select EVM);
              let xFld1 := xDoc.'Progress Project';
              let xFld2 := xDoc.'Real Progress';
              let xFld3 := xDoc.Plan_Value;
              let xFld4 := xDoc.Earned_Value;
              let xFld5 := xDoc.CPI_Project;
              let xFld6 := xDoc.SPI_Project;
              let xFld7 := xDoc.Week;
              let xFld8 := xDoc.DataDate;
              let i := (create PROGRESS);
              i.(Progess_Plan := xFld1);
              i.(Progress_Real := xFld2);
              i.(Plan := xFld3);
              i.(Earned := xFld4);
              i.(CPI_Project := xFld5);
              i.(SPI_Project := xFld6);
              i.(Week := xFld7);
              i.(Date := xFld8)
          end
      else
          closeRecord()
      end
      

      I try that but error end message .

      Like
    • Fred
    • Fred
    • 2 mths ago
    • Reported - view

    Do you want the 2nd loop to run regardless of the if statement? Then it would look something like:

    else
        closeRecord()
    end;
    
    for loop2 in select 'CUTOFF-DATES' do

    I would think that you should rename the 2nd loop variable to loop2 so as not to get confused about which loop you are in.

    Remember to close a function you have to put a “;” at the end. Then you can start another.

    Like
      • Rafael
      • Rafael Sanchis
      • Rafael_Sanchis
      • 2 mths ago
      • Reported - view

      Fred 

      Thanks Fred the Problem is in line 36 end expected.

      let check := dialog(" ATENCION ", " ¿Confirma el SETUP de la tabla de AVANCES_PROYECTO ? ", ["Si", "No"]);
      if check = "Si" then
          for loop1 in select BASELINE do
              'Date:' := loop1.Data_Date;
              let xDoc := first(select EVM);
              let xFld1 := xDoc.'Progress Project';
              let xFld2 := xDoc.Week;
              let xFld3 := xDoc.DataDate;
              let i := (create BASELINE_CURVE);
              i.(Base_PLAN := xFld1);
              i.(Week_PLAN := xFld2);
              i.(Date_PLAN := xFld3)
          end
      else
          closeRecord()
      end;
          for loop2 in select 'CUTOFF_DATES' do
              'Date:' := loop2.Date_Baseline;
              let xDoc := first(select EVM);
              let xFld1 := xDoc.'Real Progress';
              let xFld2 := xDoc.Plan_Value;
              let xFld3 := xDoc.Earned_Value;
              let xFld4 := xDoc.CPI_Project;
              let xFld5 := xDoc.SPI_Project;
              let xFld6 := xDoc.Week;
              let xFld7 := xDoc.DataDate;
              let i := (create PROGRESS);
              i.(Progress_Real := xFld1);
              i.(Plan_Value := xFld2);
              i.(Earned_Value := xFld3);
              i.(CPI_Project := xFld4);
              i.(SPI_Project := xFld5);
              i.(Week := xFld6);
              i.(Date := xFld7)
          end
      else
          closeRecord()
      end
      
      
      Like
    • Fred
    • Fred
    • 2 mths ago
    • Reported - view

    For some reason I didn't see the very end of the code.

    1) Please turn on line numbers when you Add Code Block. Click on the gear icon when editing the code and put a check next to line number.

    2) You need a 2nd if statement for loop2. You have an else but no if to start it.

    3) or you put the 2nd loop into the first else.

    Like
    • John Halls
    • John_Halls
    • 2 mths ago
    • Reported - view

    Not checked but this should work. Notice how much shorter this format is...

    let check := dialog(" ATENCION ", " ¿Confirma el SETUP de la tabla de AVANCES_PROYECTO ? ", ["Si", "No"]);
    if check = "Si" then
        for loop1 in select BASELINE do
            'Date:' := loop1.Data_Date;
            let xDoc := first(select EVM);
            (create BASELINE_CURVE).(
            Base_PLAN := xDoc.'Progress Project';
            Week_PLAN := xDoc.Week;
            Date_PLAN := xDoc.DataDate)
        end;
        for loop2 in select 'CUTOFF_DATES' do
            'Date:' := loop2.Date_Baseline;
            let xDoc := first(select EVM);
            (create PROGRESS).(
            Progress_Real := xDoc.'Real Progress';
            Plan_Value := xDoc.Plan_Value;
            Earned_Value := xDoc.Earned_Value;
            CPI_Project := xDoc.CPI_Project;
            SPI_Project := xDoc.SPI_Project;
            Week := xDoc.Week;
            Date := xDoc.DataDate)
        end
    else
        closeRecord()
    end
    

    Regards John

    Like 1
      • Rafael
      • Rafael Sanchis
      • Rafael_Sanchis
      • 2 mths ago
      • Reported - view

      John

      Fred

      Thanks a lot  appreciate your help again. 

      I work with the last version on Android 3.6 tablet but don't have the numbers line.

      Like
    • Rafael
    • Rafael Sanchis
    • Rafael_Sanchis
    • 2 mths ago
    • Reported - view

    The new Script editor is not yet available to IOS and Android tablet.

    We have already added this to our feature request list.

     

    Kind regards,

    Like
    • Fred
    • Fred
    • 2 mths ago
    • Reported - view

    I’m talking about adding line numbers in the forum not the app. 

    Like
      • Rafael
      • Rafael Sanchis
      • Rafael_Sanchis
      • 2 mths ago
      • Reported - view

      Fred Ok thanks Fred no problem and sorry 

      Like
    • Rafael
    • Rafael Sanchis
    • Rafael_Sanchis
    • 2 mths ago
    • Reported - view

    John Halls

    Fred

     

    Hi again, The First Graph I generate with a loop is the Baseline Cost Curve (Alone), the second is the same generate with a one loop, I have 3 Curve the Baseline Cost Curve, plus the Earned Curve and the Actual Cost, these last two Curve need two finish on Date of CutOff Date 13May.

    I try two combine two loop1 one for only Baseline (with all weeks 9 ) and second loop2 for the other two Curve with the only cutoff date (in these case only only 6 Weeks).

    There are some way two combine these two loop to generate the Curve.

    And please sorry but is complicated generate this last two Curve.

    I need represent the Curve like the last Graph.

    If this is not posible, I will not wasted any more time.

    Like
    • Fred
    • Fred
    • 2 mths ago
    • Reported - view

    Can you post the code you are working from?

    Like
      • Rafael
      • Rafael Sanchis
      • Rafael_Sanchis
      • 2 mths ago
      • Reported - view

      Fred 

      let check := dialog(" ATENCION ", " ¿Confirma el SETUP de la tabla de AVANCES_PROYECTO ? ", ["Si", "No"]);
      if check = "Si" then
          for loop1 in select 'CUTOFF-DATES' do
              'Date:' := loop1.Data_Date;
              let xDoc := first(select EV_Management);
              (create CURVE_Baseline).(
                  Base_Plan := xDoc.'Progress Project';
                  Plan := xDoc.Plan_Value;
                  Week_Plan := xDoc.Week;
                  Date_Plan := xDoc.DataDate
              )
          end;
          for loop2 in select CURVE_Baseline do
              'Date:' := loop2.Date_Plan;
              let xDoc := first(select EV_Management);
              (create PROGRESS).(
                  Progress_Real := xDoc.'Real Progress';
                  Plan := xDoc.Plan_Value;
                  Earned := xDoc.Earned_Value;
                  Accumulated_Cost := xDoc.Total_Cost;
              )
          end
      else
          closeRecord()
      end

      With the first loop generate the Baseline (I use all weeks project), with the second loop I try to generate the the other two Curve (I use only the weeks I cutoff) but double the result.

      I'm trying to find a solution for these Kind of graphics, but digficult.

      Like
    • Fred
    • Fred
    • 2 mths ago
    • Reported - view

    Charts are not my thing so I don't think I can help out too much.

    I tried creating a formula that does something similar where you create the records in a table then use the same table to populate another table and was able to do it without creating a doubling the 2nd set.

    Rafael said:
    I try to generate the the other two Curve (I use only the weeks I cutoff) but double the result.

     I'm not sure I follow you here. What do you mean by double the results? In which table?

    Like
    • Rafael
    • Rafael Sanchis
    • Rafael_Sanchis
    • 2 mths ago
    • Reported - view
    let check := dialog(" ATENCION ", " ¿Confirma el SETUP de la tabla de AVANCES_PROYECTO ? ", ["Si", "No"]);
    if check = "Si" then
        for loop1 in select 'CUTOFF-DATES' do
            'Date:' := loop1.Data_Date;
            let xDoc := first(select EV_Management);
            (create PROGRESS).(
                Progress_Plan := xDoc.'Progress Project';
                Progress_Real := xDoc.'Real Progress';
                Plan := xDoc.Plan_Value;
                Earned := xDoc.Earned_Value;
                Accumulated_Cost := xDoc.Total_Cost;
                CPI_Project := xDoc.CPI_Project;
                SPI_Project := xDoc.SPI_Project;
                Week := xDoc.Week;
                Date := xDoc.DataDate
            )
        end
    else
        closeRecord()
    end
    

     

    Fred

    With that Code I generate the 3 Curves (Plan, Earned and Cost)

    The Plan is OK, the Earned and Cost is ok útil 13 May, finish here the next cutoff day New values appear.

    Thank Fred the best to close this here, generate this curve in Ninox is very complicated in excel I take a minute without problem.

    Thank a lot for yor time with that.👋

    Like
Like Follow
  • Status Answered
  • 2 mths agoLast active
  • 15Replies
  • 74Views
  • 3 Following