collated program

shekar.kr

New Member
How to write a logic for bellow mentioned explanation:
Lets assume that there are 3 pages for each copy of print. If user wants 2 copies then write logic to show collated & uncollated sequence of papers.
Ex:- If print has 2 Copies, each copy has 3 pages then loop should get repeated so that
output should be shown as
11 (Indicates 1st Copy, 1st Page)
12 (Indicates 1st Copy, 2st Page)
13 (Indicates 1st Copy, 3st Page)
21 (Indicates 1st Copy, 1st Page)
22 (Indicates 1st Copy, 2st Page)
23 (Indicates 1st Copy, 3st Page)
Above mentioned sequence indicates Collated sequence.
11 (Indicates 1st Copy, 1st Page)
21 (Indicates 2nd Copy, 1st Page)
12 (Indicates 1st Copy, 2nd Page)
22 (Indicates 2nd Copy, 2nd Page)
13 (Indicates 1st Copy, 3rd Page)
23 (Indicates 2nd Copy, 3rd Page)
Above mentioned sequence indicates Un-Collated sequence.
 
def var iCopies as i no-undo init 2.
def var iPages as i no-undo init 3.
def var lCollated as l no-undo.

def var iCtr as i no-undo.
def var iCtr2 as i no-undo.

form
iCopies label "Copy"
iPages label "Page"
with frame f_1 down.

repeat:

update iCopies iPages lCollated
with frame a.

clear frame f_1 all.

if lCollated then
repeat iCtr = 1 to iCopies:
repeat iCtr2 = 1 to iPages:
disp iCtr @ iCopies iCtr2 @ iPages with frame f_1.
down with frame f_1.
end.
end.
else
repeat iCtr = 1 to iPages:
repeat iCtr2 = 1 to iCopies:
disp iCtr2 @ iCopies iCtr @ iPages with frame f_1.
down with frame f_1.
end.
end.
end.
 
Back
Top