Friday, February 24, 2012

Calculations in Page Footer

hai,
i need some help regarding calculations done in page footer. Presently i am developing a report using subreports. I am not utilising pageNofM concept. and i have to display page numbers manually. If i have 2 subreports in one main report. i have to display page numbers like this.

If my 1st subreport is displaying 2 pages, then i have to display like this

1 Page 1 of 2
1 Page 2 of 2

If my 2nd subreport is displaying 2 pages, then i have to display like this

2 Page 1 of 2
2 Page 2 of 2

Page left side printed numbers are related to subreport numbers. if the page shows first subreport then it shows 1 otherwise 2. i have coded this successfully in main report and placed this formula at left side of the page footer. i am facing problem at subreport page count. I have used to code this using page number but the left side value changes if I wrote any code in the formula which displays page 1 of 2 which i placed at right side of the page. since 1 week i am trying for this concept

can anybody help me?

Thanks in advance,
BhuvanaBhuvana,
Can you post the code you used in the formula?|||I have split the group header into 2 and placed the same subreport in each section.

I have used this code in a formula placed in each group header section

global i as number
whileprintingrecords
i=i+1
formula=i

i have used this code to display subreport number left side and placed this formula leftside of the main report page.

global i as number
whileprintingrecords
formula=replace(cstr(i),".00","")

It is perfectly working. The problem with rightside page number printing.

Rightside of the page i have used this code to print page numbers

whileprintingrecords
global i as number
global p as number

if replace(cstr(i),".00","")="1" then
formula="Page "+replace(cstr(pagenumber),".00","")
elseif replace(cstr(i),".00","")="2" then
formula="Page "+Replace(cstr((pagenumber-p)),".00","")+" of "+ Replace(cstr(p),".00","")
elseif replace(cstr(i),".00","")="3" then
formula="Page "+Replace(cstr((pagenumber-(2*p))),".00","")+" of "+ Replace(cstr(p),".00","")
elseif replace(cstr(i),".00","")="4" then
formula="Page "+Replace(cstr((pagenumber-(3*p))),".00","")+" of "+ Replace(cstr(p),".00","")
end if

and i have placed the following code in pagefooter section and supressed it

global p as number
whileprintingrecords
if {@.SampleFormula}="1" then
p=p+1
end if
formula=p

I have assigned "1" to sampleformula in first group header section and assigned 0 to sampleformula in second group header section.

Please provide me the solution
Bhuvana|||Bhuvana,
As you have used the variable formula at the right side code, change of formula will affect the value of formula at left side code. What is your expected outcome at the right side?|||hai,
suppose if i have total number of pages in 1st subreport is 4 then i want to display right side as page 1 of 4 for page 1, page 2 of 4 for page 2 and so on. while displaying second subreport first page i want to repeat as page 1 of 4 ,
page 2 of 4, page 3 of 4, page 4 of 4 etc.

i am waiting for your reply

Regards,
Bhuvana|||Bhuvana,
At the formula you used at the right side, try to use different name other than formula as that is referenced by other Formula code

No comments:

Post a Comment