Small problem with this formula
Fred
I have a small problem with this formula:
let check := dialog(" ATENCION ", " ¿Confirma el SETUP de la tabla de AVANCES_PROYECTO ? ", ["Si", "No"]);
if check = "Si" then
for loop1 in select 'FECHAS-CORTE' do
DataDate := loop1.Date;
let xDoc := first(select DOCUMENTOS);
let xFld1 := xDoc.'Avance Plan';
let xFld2 := xDoc.'Avance Real';
let xFld3 := xDoc.Semana;
let xFld4 := xDoc.DataDate;
let i := (create AVANCES_PROYECTO);
i.('Avance Plan' := xFld1);
i.('Avance Real' := xFld2);
i.('Semana Corte' := xFld3);
i.('Fecha Corte Semana' := xFld4)
end
else
closeRecord()
end
It works fine, it give me the correct result, but it does not return to the date on I which the cutoff datewas made, it stays on the last date.
If I have 12 weeks and cutoff on week 3 the Formula finish on week 12 but din't return to the 3 week.
4 replies
-
I'm not sure what table you are starting in. I say this because you say:
DataDate := loop1.Date;
and I don't know what table the field DataDate is in.
Let us walk through your for loop command:
You start by gathering all records from the FECHAS-CORTE table. Then for each record in the table you do:
1) set the field DataDate to equal the value of the Date field in FECHAS-CORTE. Again I'm not sure which table this formula starts in.
2) then you gather the first record from the DOCUMENTOS table and set a few variables. One of the variables points to a field called DataDate. I'm unsure if this is supposed to be the same one as from the first step.
3) then you create a new record in the AVANCES_PROYECTO table and set fields in this table to equal fields from the DOCUMENTOS table.
4) this all repeats for each record in FECHAS-CORTE.
If I have 12 weeks and cutoff on week 3 the Formula finish on week 12 but din't return to the 3 week.
How are you telling Ninox there is a "cutoff on week 3"?
-
Fred
Hi Fred.
In the Table FECHACORTE in the field DataDate here I change the Date, every friday.
In the Table FECHAS-CORTE I have the list of Dates I have CutOff.
The result is place in the AVANCES-PROYECTO.
The Formula works, but no return to the date I change in Table FECHACORTE
-
Please tell me which table and button/trigger you want to put this formula in?
Rafael said:
The Formula works, but no return to the date I change in Table FECHACORTEfor loop1 in select 'FECHAS-CORTE' do DataDate := loop1.Date;
Here you are setting the DataDate to be equal to the Date field in FECHAS-CORTE. So no matter what you manually enter in the DataDate field, the moment you run the script it will set it to whatever value the Date field is in FECHAS-CORTE.
If you were to set the DateDate to 8-Jul-22. You have 14 records in FECHAS-CORTE. What exactly do you want to happen when the script is run.
-
Fred
On table FECHACORTE activar Set Up yes/no you vie two Buttons the Setup Tabla - Avances PLAN y CURVA here is the Formula.
Content aside
- 2 yrs agoLast active
- 4Replies
- 37Views
-
2
Following