Jump to content

How to show record number in sub-summary


chadski021

This topic is 2388 days old. Please don't post here. Open a new topic instead.

Recommended Posts

How to show the record number in a sub-summary layout? It should start at record 1 per group, the parts of the layout are header, sub summary and body, It should look like this

Group A

1 John Doe

2 Jane Doe

Group B

1 John Doe

2 Jane Doe

Edited by chadski021
Link to comment
Share on other sites

Thats a tricky one. You may have to sort the records, then loop through them setting the number field (1, 2, 3 etc) before finally displaying your layout. Something like this.

I'm calling the number field (1 , 2 , 3 etc) myTable::index

 

Sort Records [on the sub-summary field]

Go To Record/Request/Page [First]

Set Field [ myTable::index ; 1]

If ( Get ( FoundCount ) > 1

	Set Variable [ $index ; 2 ]

	Set Variable [$currentGroup , myTable::GroupName]

	Go To Record/Request/Page [Next]

	Loop

		If [ myTable::GroupName = $currentGroup ]

			Set Field [ myTable::index ; $index ]

			Set Variable [ $index ; $index + 1 ]

		else

			Set Variable [$currentGroup , myTable::GroupName]

			Set Field [ myTable::index ; 1]

			Set Variable [ $index ; 2 ]

		End If

		Go To Record/Request/Page [Next ; Exit after last]

	End Loop

else

	// there was only one record in the found set so do nothing

end if

 

Edited by rwoods
Link to comment
Share on other sites

6 hours ago, chadski021 said:

How to show the record number in a sub-summary layout? It should start at record 1 per group,

Use a summary field defined as Count of  [any field that cannot be empty], Running count, Restart summary for each sorted group.

 

1 hour ago, rwoods said:

You may have to sort the records, then loop through them setting the number field

That would create a conflict when two users want to produce different reports.

Link to comment
Share on other sites

This topic is 2388 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.