Normal Topic Help with Sbasic Code (Read 905 times)
proudpoppy
Full Member
Members
***
Offline


Do What ??

Posts: 420
Location: South Carolina
Joined: Apr 7th, 2004
Help with Sbasic Code
Sep 28th, 2005 at 8:09pm
Print Post Print Post  
I have a element in a report, its a "sum" element formatted for money the element name is LE6, right now I get division by zero, but that as close as I've come to getting it to do what I need.
Here's the code:

Var GrandTotalvar 
Var Aptvar as Int
Var Totalpum
LE6 = GrandTotalvar
Grandtotalvar = @ToMoney(GrandTotalvar)
Aptvar = 185
Writeln(GrandTotalvar)//See if it contains the value of LE6
Totalpum = Aptvar/GrandTotalvar
LE44 = Totalpum

Thanks for any help given !!!
  
Back to top
 
IP Logged
 
Ray the Reaper
Global Moderator
Members
Lantica Support
*****
Offline


The One & The Only

Posts: 2482
Joined: Aug 20th, 2003
Re: Help with Sbasic Code
Reply #1 - Sep 28th, 2005 at 8:14pm
Print Post Print Post  
Hello,

What is the end result that you are trying to get?
LE6 is a summary calculation element correct?
What type of element is LE44?
What section of the report is LE6 in?
What section of the report is LE44 in?

-Ray
  

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


Do What ??

Posts: 420
Location: South Carolina
Joined: Apr 7th, 2004
Re: Help with Sbasic Code
Reply #2 - Sep 28th, 2005 at 8:23pm
Print Post Print Post  
Quote:
Hello,

What is the end result that you are trying to get?
LE6 is a summary calculation element correct?
What type of element is LE44?
What section of the report is LE6 in?
What section of the report is LE44 in?

-Ray

The result I'm trying to get is take the amount of money spent this year, divide it by the number of apts we have(185) and get the price spent per unit.
Right on LE6
LE44 is a number element
LE6 & LE44 or in the View Footer
  
Back to top
 
IP Logged
 
Ray the Reaper
Global Moderator
Members
Lantica Support
*****
Offline


The One & The Only

Posts: 2482
Joined: Aug 20th, 2003
Re: Help with Sbasic Code
Reply #3 - Sep 28th, 2005 at 8:42pm
Print Post Print Post  
Hello,

LE6 and LE44 need to be in seperate report sections in order for the code to work. The reason for this is because for any one section of a report the Sbasic runs before the Summary Calculations and Breaks run.  This allows breaks on calculated values and the ability to sum calculated values. If you get InsideSesame this was discussed I believe two monthes ago.

What you can do is move LE44 into the Report Footer, or LE6 into a new group footer, or create a new view whose entire purpose is to sum the money spent per year.

The code after LE6 and LE44 are put in seperate sections would be...

Code
Select All
Var GrandTotalvar as Double
Var Aptvar as Int
Var Totalpum as Double

GrandTotalVar = LE6
AptVar = 185
Totalpum = AptVar/GrandTotalVar
LE44 = Totalpum 



-Ray
  

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


Do What ??

Posts: 420
Location: South Carolina
Joined: Apr 7th, 2004
Re: Help with Sbasic Code
Reply #4 - Sep 28th, 2005 at 8:50pm
Print Post Print Post  
Thanks Ray, I'm about 6-months behind on reading Insidesesame  Grin   I suppose I'll take a break and do some reading  Wink
  
Back to top
 
IP Logged
 
Ray the Reaper
Global Moderator
Members
Lantica Support
*****
Offline


The One & The Only

Posts: 2482
Joined: Aug 20th, 2003
Re: Help with Sbasic Code
Reply #5 - Sep 28th, 2005 at 9:11pm
Print Post Print Post  
Take a break and read the article tom did on reports. It will point you in the right direction.

-Ray
  

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


Do What ??

Posts: 420
Location: South Carolina
Joined: Apr 7th, 2004
Re: Help with Sbasic Code
Reply #6 - Sep 28th, 2005 at 9:16pm
Print Post Print Post  
I'll take a break now and catch up on InsideSesame, I moved the element and pasted the code and its working fine now, had to change the next to last line, from Totalpum= AptVar/GrandTotalvar to Totalpum=GrandTotalvar/Aptvar; Thanks Again !!
  
Back to top
 
IP Logged