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
-
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?
-
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.
-
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
Content aside
- Status Answered
- 2 mths agoLast active
- 12Replies
- 76Views
-
3
Following