Click to See Complete Forum and Search --> : Printing a range of numbers


Westie
June 29th, 2006, 04:48 AM
I have given this my best shot but have still not found a solution (have tried "If's", "Do While's", "Arrays" and temporary tables).

I have a table which holds a starting serial number, ending serial number and quantity. All I need is a way to print a report which lists out all the serial numbers in the range...

i.e. if quantity is 20off and the starting serial number is 100 then I need the numbers 100 through to 119 printed out.

Any help is much appreciated....

JaganEllis
June 29th, 2006, 10:36 PM
How do you want them listed?
One per line? Comma separated?
Is that ALL that needs to be on the report - just the number list?

I assume your report selects one record from the database, so as long as you place something from the record on the report (even if it's suppressed) a formula like this should do it:


whileprintingrecords;
numbervar x;
stringvar y;

For x := {table.start_serial} To {table.end_serial} Do
(
y := y + cstr(x) + chr(13) + chr(10);
);

y


Put the formula in the detail section, and check the 'Can Grow' property.


Should be OK unless you have a huge range, but I guess you could then create another detail section and have two formulas that work on N numbers each.

Westie
June 30th, 2006, 06:17 AM
Thanks...

It works and it would seem that I was pretty much there apart from the "Can Grow" check box!

Thanks again...