Skip to Content
avatar image
Former Member

Using running total in subreport

I have 2 files: FileA (parent) and FileB (contains multiple children for each record in FileA.)


Acct PickChild

100 3

200 1


Acct ChildNum Name

100 1 Al

100 2 Barry

100 3 Charles

200 1 Amanda

200 2 Bert

200 3 Celia

I want the report to show:

100 Charles

200 Amanda

My main report has the parent id, and the subreport shows all the children records of that parent id. When showing the records in the subreport, I want the counter to show each child record with a number 1,2,3.. (I'm simplifying in describing what I want to do - I know I could put relate data from FileA and FileB in the main report). The main report will pass parameter PickChild to tell the subreport which child should be printed.

In the subreport where I created a running total of the number of records in the subreport. I created a running total field (rt_knt), as well as 2 formulas:

init: (put in report header)


numbervar kntrec:=0;

knt: (put in detail)


numbervar kntrec:=kntrec+1;

When I'm in subreport record selection, I don't have access to either of these fields - I don't see it in the report fields. While in subreport group selection, I do see formula knt, but when I do the group selection as {?Pm-PickChild}={@knt}, I get an error that this formula can't be used because it must be evaluated later.

How can I do this?


Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

1 Answer

  • Best Answer
    avatar image
    Former Member
    Jul 21, 2017 at 07:28 PM

    After asking this question, I realize I can suppress the detail section where


    I guess this gives me what I want.

    Add comment
    10|10000 characters needed characters exceeded