In article
<069d2186-cb8e-4313-b505-5dc1863c660f (AT) u12g2000prc (DOT) googlegroups.com>,
Buckbuck <buck.matthew74 (AT) yahoo (DOT) com> wrote:
Quote:
FM8.5
Is it possible to loop this script to create a set of individual pdfs
(by InvoiceID#)?
Go to Layout (xxx)
Print Setup
Show Custom Dialog (PDF Option)
If (Get ( Last message choice) = 1
Save Records as PDF Current
Else If (Get ( Last message choice) = 2
Save Records as PDF Browsed
Else if (Get ( Last message choice) = 3
Exit Script
End If
Go to Original Layout
The Found Set is
Order Status = "Shipped"
Invoice Status = "" ("" here means empty)
Not sure I understand 'Loop' protocol |
The Loop command will simply repeat all the steps between it and the
matching End Loop command. It will continue to repeat these commands
indefinitely unless you have a criteria to stop the loop (and the Scrtip
will then continue with any further commands following trhe End Loop
command).
If you want to loop through the entire Found Set, then the criteria for
ending the loop is "after the last record has been processed".
e.g.
Go To Record [First]
Loop
{Commands or Sub-script for creating PDF of current record}
Go To Record [Exit After Last; Next]
End Loop
The other usual way to stop a loop is using te Exit Loop If command, where
you can set any criteria you want - the loop will stop being performed at
the point the Exit Loop If command is performed with a matching criteria.
e.g.
Set Field [g_LoopCounter; 0]
Set Field [g_Text; ""]
Loop
Set Field [g_LoopCounter; g_LoopCounter + 1]
Set Field [g_Text; g_Text & "*"]
Exit Loop If [g_LoopCounter = 20]
Set Field [g_Text; g_Text & "$"]
End Loop
will perform the commands within the loop 20 times, and afterwards the
Field g_Text will contain 20 asterisk characters, but only 19 dollar
characters - the loop is stopped before the 20th dollar character is
appended.
The Exit Script command will also stop a loop of course.
Helpful Harry

)