Joined: 14 Sep 2011
Location: United States
Online Status: Offline
Posts: 17
Topic: While loop for printing same record multiple times Posted: 02 Feb 2017 at 9:45am
Hello.
Problem: one shipment with 4 full cartons and 1 odd quantity.
I have a report that pulls the data in the detail section, but brings in 2 records: 1 for the full cartons and 1 for the odd carton.
I need to be able to print first record 4 times and show 1 of 5, 2 of 5 3 of 5 4 of 5 and print the second record once and show 5 of 5.
I tried using the page number as a counter but I get 1 of 2, and 2 of 2 - makes sense since I have just 2 records.
I heard about whileprintingrecords and local variable and tried this formula:
Package x of Y (which is the name of my formula field I would use in my "x of y")
local numbervar i;
whileprintingrecords;
for i :=1 to {@TotalPackages} do i
i:=i+1;
where {@TotalPackages}=#full +1 odd - if exists otherwise =#full
I get an error though - says last row (where I increment) is not part of the formula...
Joined: 20 Nov 2006
Online Status: Offline
Posts: 3702
Posted: 06 Feb 2017 at 7:53am
Then there really is no way to do this directly in Crystal. You'll need to do something in the database, probably a stored procedure rather than a view, that will give you a number of records that equals the number of packages. Then use the stored procedure to provide the data for the report.
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum