you can do this by using shared variable. like if u want to count no of records per page then create two formulas
"initval " to declare as shared variable which has syntax
shared numbevar reccount := 0;
place "initval" in page header so that it is reset to 0 for each page
and create one more formula "countrec" which has syntax
shared numbervar reccount := shared numbervar reccount + 1;
place "countrec" in detail section.