0

Some idea ?

let vDd := 'Add Data|Date';
let check := dialog(" Warning ", " ¿Confirm the Progress Update by Disciplines ? ", ["Yes", "No"]);
if check = "Yes" then
    for loop1 in select 'CutOff Days' do
        'Add Data|Date' := loop1.DateCO;
        let xPry := first(select Disciplines where Discipline = "PROCESS");
        let xFld0 := xPry.Discipline;
        let xFld1 := xPry.'Data|Date';
        let xFld2 := xPry.Week;
        let xFld3 := xPry.'Plan Value';
        let xFld4 := xPry.'Earned Value';
        let xFld5 := xPry.'Plan Value %';
        let xFld6 := xPry.'Earned Value %';
        let Pgr := (create 'Progress-Disciplines');
        Pgr.(Discipline := xFld0);
        Pgr.('Date CutOff' := xFld1);
        Pgr.('Week CutOff' := xFld2);
        Pgr.('Total Plan Value' := xFld3);
        Pgr.('Total Earned Value' := if cnt((select 'Progress-Disciplines')['Total Earned Value' = xFld4]) > 0 then
                null
            else
                xFld4
            end);
        Pgr.(Plan := xFld5);
        Pgr.(Real := if cnt((select 'Progress-Disciplines')[Real = xFld6]) > 0 then
                null
            else
                xFld6
            end)
    end
else
    closeRecord()
end;
(select 'Data|Date').('Add Data|Date' := vDd);
alert(" 👍 The Update Progress Report for Google Chart created Successfully")

This code works perfect for each Discipline, but need to work for all Disciplines in table Disciplines.

Some ideas ?

12 replies

null
    • Fred
    • 2 mths ago
    • Reported - view

    Just to verify that you want to add a second loop inside the first loop?

    So instead of let xPry there would be another loop?

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

       

      Hi Fred. Explain.

      1. The button is on Data|Date Table. 

      2. The Data need to transfer is on Table Disciplinas. (All the xFldx)  7 fields. Each disciplina have this values.

      3. And trasnfer to Progress Disciplines Table.

      Need that to define the EVM curves of each discipline. Like a image but for each discipline

    • Fred
    • 2 mths ago
    • Reported - view

    You can try this:

    let vDd := 'Add Data|Date';
    let check := dialog(" Warning ", " ¿Confirm the Progress Update by Disciplines ? ", ["Yes", "No"]);
    if check = "Yes" then
        for loop1 in select 'CutOff Days' do
            'Add Data|Date' := loop1.DateCO;
            for loop2 in select Disciplines;
                let xFld0 := loop2.Discipline;
                let xFld1 := loop2.'Data|Date';
                let xFld2 := loop2.Week;
                let xFld3 := loop2.'Plan Value';
                let xFld4 := loop2.'Earned Value';
                let xFld5 := loop2.'Plan Value %';
                let xFld6 := loop2.'Earned Value %';
                let Pgr := (create 'Progress-Disciplines');
                Pgr.(Discipline := xFld0);
                Pgr.('Date CutOff' := xFld1);
                Pgr.('Week CutOff' := xFld2);
                Pgr.('Total Plan Value' := xFld3);
                Pgr.('Total Earned Value' := if cnt((select 'Progress-Disciplines')['Total Earned Value' = xFld4]) > 0 then
                        null
                    else
                        xFld4
                    end);
                Pgr.(Plan := xFld5);
                Pgr.(Real := if cnt((select 'Progress-Disciplines')[Real = xFld6]) > 0 then
                        null
                    else
                        xFld6
                    end)
            end
        end
    else
        closeRecord()
    end;
    (select 'Data|Date').('Add Data|Date' := vDd);
    alert("  The Update Progress Report for Google Chart created Successfully")
    

    Line 6, shows the change to a for loop of all records in Discilpine table. Then lines 7 - 13 show the change to access the loop variable.

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

       

      Error the loop2 not found 

      • Fred
      • 2 mths ago
      • Reported - view

      I made a mistake on line 6, what is the difference between the two loops statements?

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

       

      the First loop is for The 'CutOff Days' is a table and the field DateCo is all fridays dates for CutOff the project. This dates I generate on Dates CutOff I place the firts and last dates project

      • Fred
      • 2 mths ago
      • Reported - view

      Sorry for not being more clear. Look at the two lines. There is a word missing and a semicolon that is not needed.

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

       👍 Ready thanks a lot.

      let vDd := 'Add Data|Date';
      let check := dialog(" Warning ", " ¿Confirm the Progress Update by Disciplines ? ", ["Yes", "No"]);
      if check = "Yes" then
          for loop1 in select 'CutOff Days' do
              'Add Data|Date' := loop1.DateCO;
              for loop2 in select Disciplines do
                  let xFld0 := loop2.Discipline;
                  let xFld1 := loop2.'Data|Date';
                  let xFld2 := loop2.Week;
                  let xFld3 := loop2.'Plan Value';
                  let xFld4 := loop2.'Earned Value';
                  let xFld5 := loop2.'Plan Value %';
                  let xFld6 := loop2.'Earned Value %';
                  let Pgr := (create 'Progress-Disciplines');
                  Pgr.(Discipline := xFld0);
                  Pgr.('Date CutOff' := xFld1);
                  Pgr.('Week CutOff' := xFld2);
                  Pgr.('Total Plan Value' := xFld3);
                  Pgr.('Total Earned Value' := if cnt((select 'Progress-Disciplines')['Total Earned Value' = xFld4]) > 0 then
                          null
                      else
                          xFld4
                      end);
                  Pgr.(Plan := xFld5);
                  Pgr.(Real := if cnt((select 'Progress-Disciplines')[Real = xFld6]) > 0 then
                          null
                      else
                          xFld6
                      end)
              end
          end
      else
          closeRecord()
      end;
      (select 'Data|Date').('Add Data|Date' := vDd);
      alert("  The Update Progress Report for Google Chart created Successfully")
      
      • Rafael Sanchis
      • Rafael_Sanchis
      • 2 mths ago
      • Reported - view

       Thanks again Fred, This is the idea.👍

      https://youtu.be/IauEPWfjiyI?feature=shared

    • John_Halls
    • 2 mths ago
    • Reported - view

    I think your code can be shorted to this, at least. Test it first though...

    let vDd := 'Add Data|Date';
    if dialog(" Warning ", " ¿Confirm the Progress Update by Disciplines ? ", ["Yes", "No"]) = "Yes then
        for loop1 in select 'CutOff Days' do
            'Add Data|Date' := loop1.DateCO;
            for loop2 in select Disciplines do
                (create 'Progress-Disciplines').(
                Discipline := loop2.Discipline;
                'Date CutOff' := loop2.'Data|Date';
                'Week CutOff' := loop2.Week;
                'Total Plan Value' := loop2.'Plan Value';
                'Total Earned Value' := if cnt((select 'Progress-Disciplines')['Total Earned Value' = loop2.'Earned Value']) = 0 then
                        loop2.'Earned Value'
                    end;
                Plan := loop2.'Plan Value %';
                Real := if cnt((select 'Progress-Disciplines')[Real = loop2.'Earned Value %']) = 0 then
                        loop2.'Earned Value %'
                    end
                )
            end
        end
    else
        closeRecord()
    end;
    (select 'Data|Date').('Add Data|Date' := vDd);
    alert("  The Update Progress Report for Google Chart created Successfully")
    
    

    Regards John

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

       

      Yes John, Thanks, works perfect, only the doble "Yes"  missing.

       

      ["Yes", "No"]) = "Yes" then
      • John_Halls
      • 2 mths ago
      • Reported - view

       Fab. Always tricky when it's being coded outside of Ninox.

Content aside

  • Status Answered
  • 2 mths agoLast active
  • 12Replies
  • 76Views
  • 3 Following