Hot Topic (More than 10 Replies) Report question - decimals (Read 1393 times)
NICEBERG
Full Member
Members
***
Offline


I came, I saw, I'm still
trying to figure it out!

Posts: 208
Location: Green Bay, WI
Joined: Dec 17th, 2003
Report question - decimals
Mar 19th, 2006 at 8:26pm
Print Post Print Post  
Sorry, I don't have a lot of time today to read through the manual or check back postings - mea culpa.

Anyway, I have a report that works/looks great. Only issue is that my "Hours Worked" element doesn't print the same information from the element to the report.

Example: .25 hours is rounded down to 0; 1.5 is rounded up to 2. Not good considering the people that need this information wouldn't be getting it.

Easy fix? I hope!
Thanks again, and sorry I'm short on time
Fred
  
Back to top
 
IP Logged
 
The Cow
YaBB Administrator
*****
Offline



Posts: 2530
Joined: Nov 22nd, 2002
Re: Report question - decimals
Reply #1 - Mar 19th, 2006 at 9:09pm
Print Post Print Post  
What is the display format for that element set to?

If it is set to system, what is the system default for decimal places?

If set to "custom", how many decimal places are set?
  

Mark Lasersohn&&Programmer&&Lantica Software, LLC
Back to top
IP Logged
 
NICEBERG
Full Member
Members
***
Offline


I came, I saw, I'm still
trying to figure it out!

Posts: 208
Location: Green Bay, WI
Joined: Dec 17th, 2003
Re: Report question - decimals
Reply #2 - Mar 19th, 2006 at 9:25pm
Print Post Print Post  
Display format: Custom
Decimal places: 2

The number "displays" as expected .25 or .5
When I do a Print current record (preview) the preview shows a 0 vs .25 or 1 vs .5.
  
Back to top
 
IP Logged
 
The Cow
YaBB Administrator
*****
Offline



Posts: 2530
Joined: Nov 22nd, 2002
Re: Report question - decimals
Reply #3 - Mar 19th, 2006 at 9:27pm
Print Post Print Post  
Is it a summary calc or the result of SBasic programming?
  

Mark Lasersohn&&Programmer&&Lantica Software, LLC
Back to top
IP Logged
 
NICEBERG
Full Member
Members
***
Offline


I came, I saw, I'm still
trying to figure it out!

Posts: 208
Location: Green Bay, WI
Joined: Dec 17th, 2003
Re: Report question - decimals
Reply #4 - Mar 19th, 2006 at 9:28pm
Print Post Print Post  
Summary calc

if Total Eff Hrs >= 0 then begin
 Tot_E_Hrs = Elec * E_Hrs
 Tot_M_Hrs = Mech * M_Hrs
 Tot_W_Hrs = Weld * W_Hrs
 Tot_P_Hrs = Pipe * P_Hrs
 Tot_C_Hrs = Contractor * C_Hrs

 Total Eff Hrs = Tot_E_Hrs +
               Tot_M_Hrs +
               Tot_W_Hrs +
               Tot_P_Hrs +
               Tot_C_Hrs
 

 Total_Cost = Total Eff Hrs * 30
End

If a mechanic works on something for 1/4 hour, .25 is entered and Total Eff Hrs calcs to .25
  
Back to top
 
IP Logged
 
The Cow
YaBB Administrator
*****
Offline



Posts: 2530
Joined: Nov 22nd, 2002
Re: Report question - decimals
Reply #5 - Mar 19th, 2006 at 9:36pm
Print Post Print Post  
Looks like SBasic (not a summary calc). In any case - look for a variable that is declared as an integer being used in math with a value that is not an integer (floating point). If the destination of such an operation is an integer, the result will be an integer.

In short declare the variables as "var xxx as double".

Also place a bunch of "Writeln" calls in your code as debug statements to see intermediate values as they are being calculated. Once you have everything happy, you can remove these.
  

Mark Lasersohn&&Programmer&&Lantica Software, LLC
Back to top
IP Logged
 
NICEBERG
Full Member
Members
***
Offline


I came, I saw, I'm still
trying to figure it out!

Posts: 208
Location: Green Bay, WI
Joined: Dec 17th, 2003
Re: Report question - decimals
Reply #6 - Mar 19th, 2006 at 10:12pm
Print Post Print Post  
There are no declared variables. Each element listed in the programing statement is a number element, except Total_Cost, which is money. The programing is an on element entry for a command button. All math calculations are correct and displayed correctly on the tab. When I expect a .25 to be displayed in the Total  Eff Hrs element, it is. No issues. The above programing is the ONLY programing dealing with these elements. I don't think the Writeln calls will show me anything since I'm only dealing with raw numbers and pretty straight-forward programing: a+b+c+d+e = f.

So, everything works and displays as anticipated. Just doesn't PRINT as DISPLAYED.

Yeah, SBasic, that's what I meant - summary calc is only in a report - I knew that! Tongue
  
Back to top
 
IP Logged
 
The Cow
YaBB Administrator
*****
Offline



Posts: 2530
Joined: Nov 22nd, 2002
Re: Report question - decimals
Reply #7 - Mar 19th, 2006 at 10:24pm
Print Post Print Post  
Okay, now I'm confused. I was under the impression that this was in a report. Is the programming you showed before attached to an element in a report? Is the output format set for a form or a report?

Is that element declared as a summary calc of some kind or is it just a regular report element. If it is just a regular report element, you might try setting it to use system format. You could try deleting it and putting it back in.

If it is a summary calc element, check the output format of the data source element.
  

Mark Lasersohn&&Programmer&&Lantica Software, LLC
Back to top
IP Logged
 
The Cow
YaBB Administrator
*****
Offline



Posts: 2530
Joined: Nov 22nd, 2002
Re: Report question - decimals
Reply #8 - Mar 19th, 2006 at 10:29pm
Print Post Print Post  
Quote:
I don't think the Writeln calls will show me anything since I'm only dealing with raw numbers and pretty straight-forward programing: a+b+c+d+e = f


Actually, it is the multiplication that has me concerned:
Code
Select All
Tot_E_Hrs = Elec * E_Hrs
  Tot_M_Hrs = Mech * M_Hrs
  Tot_W_Hrs = Weld * W_Hrs
  Tot_P_Hrs = Pipe * P_Hrs
  Tot_C_Hrs = Contractor * C_Hrs
 



Are all of these ("Tot_E_hrs", "Tot_M_hrs", etc...) elements? They look like intermediate values to me.
  

Mark Lasersohn&&Programmer&&Lantica Software, LLC
Back to top
IP Logged
 
NICEBERG
Full Member
Members
***
Offline


I came, I saw, I'm still
trying to figure it out!

Posts: 208
Location: Green Bay, WI
Joined: Dec 17th, 2003
Re: Report question - decimals
Reply #9 - Mar 19th, 2006 at 10:46pm
Print Post Print Post  
They are each elements manually filled in with the desired values. In this instance 1 electrician worked .25 hours. The two elements are filled in:

Elec = 1
E_Hrs = .25
(calc command button selected)
Tot_E_Hrs = 1x.25 = .25 (expected result)
Total Eff Hrs = .25 (expected result)

Report: Total Eff Hrs: 0
(Mind boggling)
Thanks for your effort and patience


  
Back to top
 
IP Logged
 
The Cow
YaBB Administrator
*****
Offline



Posts: 2530
Joined: Nov 22nd, 2002
Re: Report question - decimals
Reply #10 - Mar 19th, 2006 at 10:50pm
Print Post Print Post  
How big total (in bytes) are the .dat and .db files?

Can this wait until Ray gets in tomorrow?

If not, and the files are pretty small, I'll take a look at it tonight.
  

Mark Lasersohn&&Programmer&&Lantica Software, LLC
Back to top
IP Logged
 
NICEBERG
Full Member
Members
***
Offline


I came, I saw, I'm still
trying to figure it out!

Posts: 208
Location: Green Bay, WI
Joined: Dec 17th, 2003
Re: Report question - decimals
Reply #11 - Mar 19th, 2006 at 10:56pm
Print Post Print Post  
This can wait - actually till next Friday since I only work Fri-Sun. You did clue me into some things to check in the report part of it. I'll bet that's where it's messed up now that I think about it.

Thanks again so much for your help!!
  
Back to top
 
IP Logged
 
NICEBERG
Full Member
Members
***
Offline


I came, I saw, I'm still
trying to figure it out!

Posts: 208
Location: Green Bay, WI
Joined: Dec 17th, 2003
Re: Report question - decimals
Reply #12 - Mar 19th, 2006 at 11:04pm
Print Post Print Post  
That was it - you asked the right questions about decimals - and I checked on the form, not the report. Talk about a brain-fa--!! ROFLMAO

I'll be more careful next time - honest! Rushed today.
  
Back to top
 
IP Logged
 
The Cow
YaBB Administrator
*****
Offline



Posts: 2530
Joined: Nov 22nd, 2002
Re: Report question - decimals
Reply #13 - Mar 19th, 2006 at 11:06pm
Print Post Print Post  
No problem.

Just curious, what do you do Monday through Thursday?
  

Mark Lasersohn&&Programmer&&Lantica Software, LLC
Back to top
IP Logged
 
NICEBERG
Full Member
Members
***
Offline


I came, I saw, I'm still
trying to figure it out!

Posts: 208
Location: Green Bay, WI
Joined: Dec 17th, 2003
Re: Report question - decimals
Reply #14 - Mar 20th, 2006 at 3:05am
Print Post Print Post  
Mon-Thurs = "enjoy life" in a special Element

I was retired for 6 years (at a very young age) and now I've got a great hobby job that allows me to play with my new fav toy - Sesame! (although this is not my primary job  Embarrassed )

I'm at home now, so I can REALLY apologize. It was hectic at work and I just didn't have time to sit down and think things through. I really laughed at myself all the way home tonight! I just feel sorry for you having to scratch your head and having to think of what the heck this idiot was talking about. As I re-read things - I sound like someone who doesn't even know what the heck a computer is.....too funny.

I've said this in the past - you guys are the greatest -- BEST support ANYWHERE on the web! (And my bosses are beginning to believe me!)
  
Back to top
 
IP Logged