0

Remove the repeated values from CutOff

Hi all again 

Starting from CutOff Date I need to remove the repeated values, In the picture the case, as CutOff Date 31/March/2023, eliminate the values of Real and Cumulative Cost down from 07/April/2023 to end Finish CutOff Date 

CutOff Date is every 7 days Friday to Friday. 

Is possible with a Button script  ?

In this example is only few items but on some projects maybe a lot values.

11 replies

null
    • Rafael Sanchis
    • Rafael_Sanchis
    • 1 yr ago
    • Reported - view

    No ideas 

      • Rafael Sanchis
      • Rafael_Sanchis
      • 1 yr ago
      • Reported - view
      for i in (select 'Progress-Cost Report').'Total Earned Real' do
          while cnt(select 'Progress-Cost Report' where 'Total Earned Real' = text(i)) != 1 do
              delete last(select 'Progress-Cost Report' where 'Total Earned Real' = text(i))
          end
      
      end
      

      I try this but delete Records no fields

    • Fred
    • 1 yr ago
    • Reported - view

    How are these duplicate records created? Can you "fix" the problem before it happens?

      • Rafael Sanchis
      • Rafael_Sanchis
      • 1 yr ago
      • Reported - view

      Fred Hi Fred

      I used this Formula 

      let check := dialog(" Warning ", " ¿Confirm the Update Progress Project? ", ["Yes", "No"]);
      if check = "Yes" then
          for loop1 in select CutOff do
              CutOff_ := loop1.DateCO;
              let xPry := first(select Project);
              let xFld0 := xPry.'% Plan';
              let xFld1 := xPry.'% Earned';
              let xFld2 := xPry.'Data|Date';
              let xFld3 := xPry.Week;
              let xFld4 := xPry.'Plan Value PV';
              let xFld5 := xPry.'Earned Value EV';
              let xFld6 := xPry.'Cost Week';
              let xFld7 := xPry.SPI;
              let xFld8 := xPry.CPI;
              let xFld9 := xPry.'Plan Hours';
              let xFld10 := xPry.'Earned Hours';
              let Pgr := (create 'Progress Report');
              Pgr.(Plan := xFld0);
              Pgr.(Real := xFld1);
              Pgr.('Date CutOff' := xFld2);
              Pgr.('Week CutOff' := xFld3);
              Pgr.('Total Earned Plan' := xFld4);
              Pgr.('Total Earned Real' := xFld5);
              Pgr.('Gasto Semana' := xFld6);
              Pgr.(SPI := xFld7);
              Pgr.(CPI := xFld8);
              Pgr.(Plan_Hours := xFld9);
              Pgr.(Earned_Hours := xFld10)
          end
      else
          closeRecord()
      end
      

      The result is.

      Repeats from the cut-off date 7 Apr 2023 (Real, Cumulative Cost and Earned Hours)

    • Fred
    • 1 yr ago
    • Reported - view
    Rafael said:
    Repeats from the cut-off date 7 Apr 2023 (Real, Cumulative Cost and Earned Hours)

     It looks like the 7 Apr and later records have no data for Gasto Semana. Can you use that to limit the record creation? Maybe something like?

    for loop1 in select CutOff where 'Gasto Semana' != 0 do

    Also you can move the let xPry to outside the loop so you don’t do the select over and over. You can do this since you don’t do anything but gather the first record from the Project table.

    let xPry := first(select Project);
    let check := dialog(" Warning ", " ¿Confirm the Update Progress Project? ", ["Yes", "No"]);
    if check = "Yes" then
        for loop1 in select CutOff do
            CutOff_ := loop1.DateCO;
    
      • Rafael Sanchis
      • Rafael_Sanchis
      • 1 yr ago
      • Reported - view
      • Fred Hi Fred Thanks for you patience with me👍

      Only I should move from the first loop the Values, ( Real, Cumulative Cost and Earned Value) These three values are the ones that are repeated after Cut-off Date. I Need these repeated values to be 0.

      Steven help me with the Graph Curve.

      The first graph is perfect, the second no is perfect because have the repeated Value on Cumulative Cost after the Cut- Off.

      I have the same problem with Real and Earned Hours Curve.

    • Ninox partner
    • RoSoft_Steven.1
    • 1 yr ago
    • Reported - view
    let check := dialog(" Warning ", " ¿Confirm the Update Progress Project? ", ["Yes", "No"]);
    if check = "Yes" then
        for loop1 in select CutOff do
            CutOff_ := loop1.DateCO;
            let xPry := first(select Project);
            let xFld0 := xPry.'% Plan';
            let xFld1 := xPry.'% Earned';
            let xFld2 := xPry.'Data|Date';
            let xFld3 := xPry.Week;
            let xFld4 := xPry.'Plan Value PV';
            let xFld5 := xPry.'Earned Value EV';
            let xFld6 := xPry.'Cost Week';
            let xFld7 := xPry.SPI;
            let xFld8 := xPry.CPI;
            let xFld9 := xPry.'Plan Hours';
            let xFld10 := xPry.'Earned Hours';
            let Pgr := (create 'Progress Report');
            Pgr.(Plan := if cnt((select 'Progress Report')[Plan=xFld0]) > 0 then
                       null
                    else
                       xFld0
                    end);
            Pgr.(Real := if cnt((select 'Progress Report')[Real=xFld1]) > 0 then
                       null
                    else
                       xFld1
                    end);
            Pgr.('Date CutOff' := xFld2);
            Pgr.('Week CutOff' := xFld3);
            Pgr.('Total Earned Plan' := xFld4);
            Pgr.('Total Earned Real' := xFld5);
            Pgr.('Gasto Semana' := xFld6);
            Pgr.(SPI := xFld7);
            Pgr.(CPI := xFld8);
            Pgr.(Plan_Hours := xFld9);
            Pgr.(Earned_Hours := xFld10)
        end
    else
        closeRecord()
    end
    

    Try this in your button.

    I just look for the fields Real and Plan as you can see, but you can expand it for other fields aswell. (Maybe wrapping the whole in a 'do as server' would make things more faster)

      • Rafael Sanchis
      • Rafael_Sanchis
      • 1 yr ago
      • Reported - view

      RoSoft_Steven Thanks Steven try it later. Appreciate 

      • Rafael Sanchis
      • Rafael_Sanchis
      • 1 yr ago
      • Reported - view

      RoSoft_Steven 

      Fred

      Thanks Steven works perfect, finally achieved 👋👋 

      • Ninox partner
      • RoSoft_Steven.1
      • 1 yr ago
      • Reported - view

      Rafael 👍 Glad you sorted it out

      • Rafael Sanchis
      • Rafael_Sanchis
      • 1 yr ago
      • Reported - view

      RoSoft_Steven 

      Fred

      Many thanks to You and Fred have helped me a lot this year.

Content aside

  • Status Answered
  • 1 yr agoLast active
  • 11Replies
  • 141Views
  • 3 Following