
Making software work for you
|
| View previous topic :: View next topic |
| Author |
Message |
| Crewdawg
 | | Joined: 28 Oct 2005 | | Posts: 17 | | Location: Bangor, Maine |
|
Posted: Fri Oct 28, 2005 2:38 pm Post subject: Improving Syntax on this formula. |
|
|
First off I want to say bear with me on this. I may leave out some key piece of information here so just post what other information you need to understand what I'm showing you.
This report shows our "Planned" and "Actual" times on individual jobs on a Work Order. It has a line for each job and then there is a Running Total on the bottom of the page. The problem is the database saves this "Time Field" (expressed as hh.mm) as a "Number Field". For example if we planned to put 3 hours and 30 minutes on a job the database stores this as 3.3. If we actuallu put 3 hours 37 minutes on the job the database stores this as 3.37. The formula I have included below works for a good estimate and tends to be fairly accurate when dealing with small workorders or individual numbers. The majority of work orders in which I need to use this report include a 1000 individual jobs. So after round several times on each line, and then doing a running talley on these 1000 lines, you can see why the reports can be hundreds of hours off when compared to the hard numbers.
The WOMNT_CARD.STANDARD_HOURS_DURATION field is where the database stores the "Planned Hours" for each particular card. The formula below is used on a report field named @PlannedMinutes (Number Field).
Round(Round ({WOMNT_CARD.STANDARD_HOURS_DURATION}, 0) + ((Remainder ({WOMNT_CARD.STANDARD_HOURS_DURATION}, 1) *100) / 60), 2)
I hope this makes sense to those reading. Your sugestions are greatly appreciated. As you can see by the images below the Planned total is only 18 hrs off, but the Actual total is 170hrs different.
This image is an example of what my Crystal Report generates.
This is an example of what my internal system generates.
 _________________ ----------------------------------------------------
Multithreading is just one thing after, before, or simultaneous with another. |
|
| Back to top |
|
 |
| kgroff Site Admin
 | | Joined: 27 Jan 2005 | | Posts: 694 | |
|
Posted: Mon Oct 31, 2005 8:23 am Post subject: |
|
|
Try something like:
truncate({WOMNT_CARD.STANDARD_HOURS_DURATION})+(({WOMNT_CARD.STANDARD_HOURS_DURATION}-truncate({WOMNT_CARD.STANDARD_HOURS_DURATION}))*100/60) |
|
| Back to top |
|
 |
| Crewdawg
 | | Joined: 28 Oct 2005 | | Posts: 17 | | Location: Bangor, Maine |
|
Posted: Thu Nov 17, 2005 4:41 pm Post subject: Solution |
|
|
Between your post and another post on tek-tips.com I was able to quickly solve my problem and improve my report. Thanks all to contributed. here is a quote from user LBASS at Tek-Tips.
| Quote: | I think you should convert the number field to minutes before summing (or using a running total). Try a formula like:
(truncate({table.number})*60)+(({table.number}-truncate({table.number}))*100)
Then when you have a summary, convert it into the hh:mm format, if you wish. Let's assume your summary is a running total {#minutes}. Then the conversion formula would look like:
totext(truncate({#minutes}/60),0,"")+":"+totext(remainder({#minutes},60),0,"")
If you want to use "." instead of ":" then substitute that in the formula.
-LB |
We later chenged the later formula to | Quote: | | totext(truncate({#minutes}/60),"00")+":"+totext(remainder({#minutes},60),"00") |
to keep formating consistant with what I was looking for.
Thanks for all your help. _________________ ----------------------------------------------------
Multithreading is just one thing after, before, or simultaneous with another. |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You can delete your posts in this forum You cannot vote in polls in this forum
|
|