0

Some little Help

let check := dialog(" ATENCION ", " ¿Confirmar la Actualizacion de los Datos en la tabla de AVANCES_PROYECTO ? ", ["Si", "No"]);
if check = "Si" then
    for loop1 in select WeeksCutOff do
        Data_Date := loop1.Date;
        let xDoc := first(select Deliverables);
        let xFld1 := xDoc.'Avance Plan';
        let xFld2 := xDoc.'Avance Real';
        let xFld3 := xDoc.Week;
        let xFld4 := xDoc.DataDate;
        let i := (create Avance_Proyecto);
        i.('Avance Plan' := xFld1);
        i.('Avance Real' := xFld2);
        i.(Semana_Corte := xFld3);
        i.(Fecha_Corte := xFld4)
    end
else
    closeRecord()
end

 

This Formula work OK but I have  little problem what I want to Solve, if possible.

The WeeksCutOff is the table where I have all fields CutOff Dates, the field Data_Date is where I change the CutOffDate on the Table CurOff and field Date is the name of WeekCutOff. All works OK.

But example when I CutOff 16Dec2022 All calculation are OK but the Data_Date change to the first Date on table WeekCutOff 04Nov2022, there are any way to keeping the same Date I CutOff.

Thanks.

5 replies

null
    • Fred
    • 1 yr ago
    • Reported - view

    You wrote:

       for loop1 in select WeeksCutOff do
            Data_Date := loop1.Date;
    

    Since loop1 is equal to each record in WeeksCutOff, you then make Data_Date equal to the Date in each record. Any changes to Data_Date has to start here.

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

      Fred Hi Fred Do you say is not possible ? 

    • Fred
    • 1 yr ago
    • Reported - view
    Rafael said:
    Do you say is not possible ? 

     I didn't say it is not possible. I don't know how everything works so I was just pointing you to where you are setting Data_Date. If you don't want Data_Date to be equal to "the first Date on table WeekCutOff 04Nov2022" then you have to change the line where you set the Data_Date.

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

      Fred 

      OK I send my Evaluation DB.

      My Procedure, on the Table CutOff I have the field Data_Date on 16Dec2022, next on the Button Delete Tabla Avance Proyecto I Click and Delete all Records on Table Avance_Proyecto, next I Click on the SetUp Tabla Avance Plan y Curva this button Update all information on Avance _Proyect with the Date_Date I selected. If you see the Data_Date go to 04Nov2022 and I need to place again the Cutoff Date on 16Dec2022, but the calculation is OK. I'm doing every Fryday this procedure.

      This DB is a evaluation is no my main DB.

    • Fred
    • 1 yr ago
    • Reported - view

    Looking at your DB, my question is still the same.

    let check := dialog(" ATENCION ", " ¿Confirmar la Actualizacion de los Datos en la tabla de AVANCES_PROYECTO ? ", ["Si", "No"]);
    if check = "Si" then
        for loop1 in select WeeksCutOff do
            Data_Date := loop1.Date;
    

    Though now I can describe it a bit better. In line 4 you are setting the field Data_Date in the Cutoff table to be equal to the record that the loop is in. The last record in the WeeksCutOff table has a date of Nov 4, 2022 so that is what Data_Date in Cutoff will end up showing when the script is complete.

    You say you don't want to change Date_Date in Cutoff so you can just remove this line and the Data_Date in Cutoff will not change when you press the button.

    So my next question is did you mean line 4 to be a variable? If so then you need to set it up as a variable:

    let xData_Date := loop1.Date
    

    Then figure out where you need what you want to do with this data later in the code.

    If you remove or modify line 4, the Avance_Proyetco table will have the same date for Fecha_Corte. I don't know if that is what you want, but that is what will happen. I don't know which dates you want in Avance_Proyecto so you will have to figure that out.

    Currently you have:

    let xDoc := first(select Deliverables);
            let xFld1 := xDoc.'Avance Plan';
            let xFld2 := xDoc.'Avance Real';
            let xFld3 := xDoc.Week;
            let xFld4 := xDoc.DataDate;
    let i := (create Avance_Proyecto);
            i.('Avance Plan' := xFld1);
            i.('Avance Real' := xFld2);
            i.(Semana_Corte := xFld3);
            i.(Fecha_Corte := xFld4)
    

    After a bit of digging, I find that DataDate in Deliverables table points to Data_Date in CutOff table. So that means you will make each new record in Avance_Proyecto then set the Fecha_Corte in be equal to Data_Date in Cutoff.

    I'm going to guess that you want is the data from Date in WeeksCutOff to be set into Fecha_Corte in Avance_Proyecto. If so then it would look something like:

        for loop1 in select WeeksCutOff do
            let xDoc := first(select Deliverables);
            let xFld1 := xDoc.'Avance Plan';
            let xFld2 := xDoc.'Avance Real';
            let xFld3 := xDoc.Week;
            let i := (create Avance_Proyecto);
            i.('Avance Plan' := xFld1);
            i.('Avance Real' := xFld2);
            i.(Semana_Corte := xFld3);
            i.(Fecha_Corte := loop1.Date)
    

Content aside

  • 1 yr agoLast active
  • 5Replies
  • 62Views
  • 2 Following