Monday, July 13, 2015

Page N of M

Hi,
In NAV2013R2, It is easy to print page no. like "1 of 10" but in NAV2009, It is a logical because there is no any function to find out total page no. I have also never done this task in classic view but I tried to solve this query because it was a new for me and asked by one of my colleague. Now I am going to write down the step by step procedure to implement it.

1) Create the new Form named "Page N of M" FROM Customer table.


2) Form Design view will look like this...



3) Add the following global variables...
 Name DataType Subtype Length
Txt000 Text 100
CountRec Integer
r Decimal
q Integer
Flag Integer

4) Write the following code on "OnInit Report"....

MESSAGE('%1',Customer.COUNT);

                   Txt000 := ' of ';

5) Write the following code on "OnPreSection" of Customer body....

CountRec += 1;


6) Write the following code on "OnPreSection" of Customer Footer....

                               Flag +=1;
                                IF Flag=1 THEN BEGIN
                                   MESSAGE('%1',CountRec);
                                   r := COUNT MOD CountRec;
                                   q := COUNT DIV CountRec;
                                   IF r > 0 THEN
                                   q := q+1;
                                   Txt000 := Txt000 + FORMAT(q);

                                 END;


7) Now save and close the form and run.





You can also find the object from this link

Thanks
Niraj Kumar

http://niraj-msnav.blogspot.com
http://nirajdynamicsnav.wordpress.com




No comments:

Post a Comment