Hi,
I'm not a professional programmer, but sometimes I have to modify an existing Progress program. So, now I've got some trouble when reading the same table within nested blocks. First, I took three nested "for each" statements. When I got syntax errors, I put a "repeat-loop" around it and used combinations with "find first" and "for each". Nothing seems to be correct. Does anybody has an advice, how to read three different records in the same table, when always key-fields from the previous fetched record are needed?
Thanks in advance.
current_shipfrom = shipfrom1
current_shipper = shipper1
repeat while current_shipper <= shipper2:
find first abs_mstr /* read shipper header */
where abs_shipfrom = current_shipfrom
and abs_id = current_shipper:
run save_shipper_header.
for each abs_mstr /* read shipper container */
where abs_shipfrom = header_abs_shipfrom
and abs_par_id = header_abs_par_id:
run save_shipper_container.
find first abs_mstr /* read shipper item */
where abs_shipfrom = header_shipfrom
and abs_par_id = container_abs_id:
run save_shipper_item
run generate_boxlabel_files.
end.
end.
decimal(current_shipper) = decimal(current_shipper)+1.
end.
end.
I'm not a professional programmer, but sometimes I have to modify an existing Progress program. So, now I've got some trouble when reading the same table within nested blocks. First, I took three nested "for each" statements. When I got syntax errors, I put a "repeat-loop" around it and used combinations with "find first" and "for each". Nothing seems to be correct. Does anybody has an advice, how to read three different records in the same table, when always key-fields from the previous fetched record are needed?
Thanks in advance.
current_shipfrom = shipfrom1
current_shipper = shipper1
repeat while current_shipper <= shipper2:
find first abs_mstr /* read shipper header */
where abs_shipfrom = current_shipfrom
and abs_id = current_shipper:
run save_shipper_header.
for each abs_mstr /* read shipper container */
where abs_shipfrom = header_abs_shipfrom
and abs_par_id = header_abs_par_id:
run save_shipper_container.
find first abs_mstr /* read shipper item */
where abs_shipfrom = header_shipfrom
and abs_par_id = container_abs_id:
run save_shipper_item
run generate_boxlabel_files.
end.
end.
decimal(current_shipper) = decimal(current_shipper)+1.
end.
end.