The report is sorted by Document Name and shows the following fields in the Header Section
Document Name
Number of Pages
- Detail Section I have a formula that shows the New Document Name ;
docid :=
REPLACE(REPLACE(TOTEXT({?Pm-STATEFUN_NEW.DWDOCID}),",",""),".00","")
+ "." +
IF LEN(REPLACE(REPLACE(TOTEXT({@increment}),",",""),".00","")) = 1 THEN
"00" + REPLACE(TOTEXT({@increment}),".00","")
ELSE
IF LEN(REPLACE(REPLACE(TOTEXT({@increment}),",",""),".00","")) = 2 THEN
"0" + REPLACE(TOTEXT({@increment}),".0","")
ELSE
IF LEN(REPLACE(REPLACE(TOTEXT({@increment}),",",""),".00","")) = 3 THEN
REPLACE(TOTEXT({@increment}),".","")
I got the Document Name to display once - I need it to display based on the Number of pages.
----------------------------------------------------
So I tried a sub-report to show the new document name by the same formula above and added the line shared stringvar docid.
shared stringvar docid;
docid :=
REPLACE(REPLACE(TOTEXT({?Pm-STATEFUN_NEW.DWDOCID}),",",""),".00","")
+ "." +
IF LEN(REPLACE(REPLACE(TOTEXT({@increment}),",",""),".00","")) = 1 THEN
"00" + REPLACE(TOTEXT({@increment}),".00","")
ELSE
IF LEN(REPLACE(REPLACE(TOTEXT({@increment}),",",""),".00","")) = 2 THEN
"0" + REPLACE(TOTEXT({@increment}),".0","")
ELSE
IF LEN(REPLACE(REPLACE(TOTEXT({@increment}),",",""),".00","")) = 3 THEN
REPLACE(TOTEXT({@increment}),".","")
I need to access the sub-report so many times before it reads the next record in the table, the number of times is based on the field Number of Pages.