Subject: | |
From: | |
Reply To: | |
Date: | Wed, 15 Jan 2014 11:37:17 -0500 |
Content-Type: | multipart/alternative |
Parts/Attachments: |
|
|
I'm stumped with the following script.
Enter script with Rand.Count set to a random number, and
gSort2 equal to 1
gRangeBegin equal to 1
gRangeEnd equal to 16
The script is supposed to number the found records from 1 through 200 by
first finding the group which may be numbered from 1 through 16, and then
numbering the count field. This is determined by beginning with the number
of the group and giving it to the first field, then adding 16 to it and
giving the sum to the next field. This is repeated until the next count
would be greater than 200.
My problem is that the script seems to be skipping a number. At first it
was 199, then it was 183, both from the 7 group. The last thing I tried was
to step through the script by pausing just before the second loop begins.
When I got to the record where count should be 183, it jumped to 199.
Any idea what I'm doing wrong?
Loop
Enter Find Mode [ ]
Set Field [ QR::group; QR::gSort2 ]
Perform Find [ ]
Sort Records [ Keep records in sorted order; Specified Sort Order:
QR::Rand.Count; ascending ] [ Restore; No dialog ]
Go to Record/Request/Page [ First ]
Loop
Set Field [ QR::count; QR::gRangeBegin ]
Insert Calculated Result [ QR::gRangeBegin; QR::gRangeBegin + QR::gRangeEnd
][ Select ]
Exit Loop If [ QR::gRangeBegin > 200 ]
Go to Record/Request/Page[ Next ]
End Loop
Insert Calculated Result [ QR::gSort2; QR::gSort2 + 1 ] [ Select ]
Set Field [ QR::gRangeBegin; QR::gSort2 ]
Exit Loop If [ QR::gSort2 > 16 ]
End Loop
|
|
|