Normal Topic Reporting Sub-Totals and Grand Totals (Read 1060 times)
wildwood
Full Member
***
Offline


No personal text

Posts: 156
Location: New York
Joined: Apr 2nd, 2004
Reporting Sub-Totals and Grand Totals
May 11th, 2004 at 2:24am
Print Post Print Post  
Perhaps you can help with a reporting problem i'm having.
My application has the following LE's:

Camper Name:
Group:

Basically I run a summer camp and want to show the total number of campers in each group and the grand total of all campers.

In Q&A I was able to do a report as follows:

Group       Totals

Cedar/Pines    30
Hemlocks    41
Oaks      42
Sycamores  27

Grand Total   140      

In Sesame I get the group name for each camper with the proper subcounts and grand total. How do I get the name of each group to appear only once as I did in Q&A.

Thanks,
Peter
  
Back to top
 
IP Logged
 
Ray the Reaper
Global Moderator
Members
Lantica Support
*****
Offline


The One & The Only

Posts: 2480
Joined: Aug 20th, 2003
Re: Reporting Sub-Totals and Grand Totals
Reply #1 - May 11th, 2004 at 5:47pm
Print Post Print Post  
Hello Peter,

In Sesame reports, the Group Body will repeat for each record, so it will either display the name of the group again or a blank line. The solution lies in SBasic. Are you looking to print this report out, just see it on the screen or both?  Which would be more convienent for you: a saved Mass Update or a Command Button that, when clicked, will run the report?

  

Raymond Yoxall Consulting
ray.yoxall@gmail.com
ryoxall@lantica.com
Sesame Applications, Design and Support
Back to top
IP Logged
 
wildwood
Full Member
***
Offline


No personal text

Posts: 156
Location: New York
Joined: Apr 2nd, 2004
Re: Reporting Sub-Totals and Grand Totals
Reply #2 - May 11th, 2004 at 9:43pm
Print Post Print Post  
Dear Ray,
Thanks for your response. I would like to print the report so that it becomes a one page report as opposed to several pages when the group name appears for each camper.
I would prefer anything that runs this friggin report the way Q&A did!
Thanks,
Peter
  
Back to top
 
IP Logged
 
Ray the Reaper
Global Moderator
Members
Lantica Support
*****
Offline


The One & The Only

Posts: 2480
Joined: Aug 20th, 2003
Re: Reporting Sub-Totals and Grand Totals
Reply #3 - May 12th, 2004 at 4:55pm
Print Post Print Post  
Hello Peter

You will need to add a Command Button to your form and then put the Following code in the "On Element Entry" event.  You will need to replace "MyForm" in four places with the name of your form. You will also need to replace "GroupNumber" in three places with the name of the Field that contains the Unique Number for each group. As long as the Group field is named "GROUP" then you will not need to change anything else.

In order for this report to work correctly the records need to be sorted either by Group or by the Unique Group Number. If you have any more questions about the code do not hesitate to ask.

Code
Select All
Var vGroup as int
Var vRecord as int
Var vRecordTotal as int
Var vPosition as int
Var vCount as int
Var vTotal as int
Var vGroupName as String
Var vSuccess as int

vRecordTotal = @FormResultSetTotal("MyForm")

If vRecordTotal > 0 Then
{
	vRecord = 1
	vGroup = -1
	vPosition = @FormResultSetCurrentPosition("MyForm")
	NewPage(850,1100)
	PrintString("Number of Campers in Each Group", 50, 35, 0, "Arial", 20, 0)
	PrintString(" ", 50, 60, 0, "", 0, 0)
	While vRecord <= vRecordTotal
	{
		FormResultSetCurrentPosition("MyForm", vRecord)
		If vRecord = 1 Then
		{
			vGroup = GroupNumber
			vGroupName = GROUP
		}

		If vGroup = GroupNumber Then
		{
			//Same Group
			vCount = vCount + 1
		}
		Else
		{
			//New Group
			PrintString(vGroupName, 50, @PageExtentY() + 2, 125, "Arial", 15, 0)
			Printstring(vCount, -1, -1, 0, "Arial", 15, 0)
			vGroupName = GROUP
			vTotal = vTotal + vCount
			vGroup = GroupNumber
			vCount = 1
		}
		vRecord = vRecord + 1
	}
	PrintString(GROUP, 50, @PageExtentY() + 2, 125, "Arial", 15, 0)
	PrintString(vCount, -1, -1, 0, "Arial", 15, 0)
	vTotal = vTotal + vCount
	PrintString("Total Number of Campers " + VTotal, 50, @PageExtentY() + 20, 0, "Arial", 20, 0)
	FinishPage()

	//Returns user to the record they were on
	FormResultSetCurrentPosition("MyForm", vPosition)

}
 


Note: If any lines are wrapped they will need to be unwrapped in the Program Editor.
  

Raymond Yoxall Consulting
ray.yoxall@gmail.com
ryoxall@lantica.com
Sesame Applications, Design and Support
Back to top
IP Logged
 
wildwood
Full Member
***
Offline


No personal text

Posts: 156
Location: New York
Joined: Apr 2nd, 2004
Re: Reporting Sub-Totals and Grand Totals
Reply #4 - May 12th, 2004 at 6:34pm
Print Post Print Post  
Ray,
Thanks, the report prints just the way I wanted. But how can I get this report into the Reports section in Sesame where you can choose Report (preview) or Report (immediate)?

Peter
  
Back to top
 
IP Logged
 
Ray the Reaper
Global Moderator
Members
Lantica Support
*****
Offline


The One & The Only

Posts: 2480
Joined: Aug 20th, 2003
Re: Reporting Sub-Totals and Grand Totals
Reply #5 - May 12th, 2004 at 7:01pm
Print Post Print Post  
Hello Peter,

The Report that the code builds really isn't a Report like the ones listed in the tree. The report is built entirly in Code.
  

Raymond Yoxall Consulting
ray.yoxall@gmail.com
ryoxall@lantica.com
Sesame Applications, Design and Support
Back to top
IP Logged