?
Solved

How to find a rate

Posted on 2011-09-13
6
Medium Priority
?
374 Views
Last Modified: 2012-05-12
How can I find a numerical value this equation to be multiplied by another number ($41.56/hour)

In the equation below I return a time. I then want to take that time and multiply it by (41.56) and get my result to again multiple by a number

How can I do this?

Shared NumberVar scrapped_Time;
numberVar dur := scrapped_Time;
numberVar hrs;
numberVar min;
numberVar sec;
stringVar hhmmss;

hrs := Truncate(Truncate(dur/60)/60);
min := Remainder(Truncate(dur/60),60);
sec := Remainder(dur,60);

hhmmss := totext(hrs,"0") + ":" + totext(min,"00") + ":"+ totext(sec,"00");

Open in new window

0
Comment
Question by:cmdolcet
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 35

Expert Comment

by:johnsone
ID: 36532390
The rate should be:

(hrs*41.56) + ((min/60)*41.56) + ((sec/3600)*4156)

0
 
LVL 35

Expert Comment

by:johnsone
ID: 36532394
Sorry, missed a decimal place:

(hrs*41.56) + ((min/60)*41.56) + ((sec/3600)*41.56)
0
 
LVL 101

Expert Comment

by:mlmcc
ID: 36532463
Or just

  (dur/3660) * 41.56

mlmcc
0
Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

 
LVL 57

Expert Comment

by:HainKurt
ID: 36532504
"I return a time" --> I guess you are returning a text like "2:34:56"

create a function to convert this to number

first split it by ":", then convert each piece to numeric, convert each piece to hour

numberVar v = (int)split("2:34:56",":")[0] + (int)split("2:34:56",":")[1]/60 + (int)split("2:34:56",":")[2]/(60*60)

and use this function to convert your time (actually string) into numerical values...

float Convert2Num(t) {
  the logic above, and return numeric value
}


Convert2Num("2:34:56") = 2.5822
0
 
LVL 101

Accepted Solution

by:
mlmcc earned 500 total points
ID: 36532974
Change your formula to
Name - YourFormula
Shared NumberVar scrapped_Time;
numberVar dur := scrapped_Time;
numberVar hrs;
numberVar min;
numberVar sec;
stringVar hhmmss;
numbervar amount;

amount := dur / 3600 * 41.56;
hrs := Truncate(Truncate(dur/60)/60);
min := Remainder(Truncate(dur/60),60);
sec := Remainder(dur,60);

hhmmss := totext(hrs,"0") + ":" + totext(min,"00") + ":"+ totext(sec,"00");


Add another formula to display the value calculated
EvaluateAFter({@YourFormula});
numbervar amount;
amount

mlmcc
0
 
LVL 35

Expert Comment

by:James0628
ID: 36538784
Or, since you've already got the time in scrapped_Time, you could just use that.  Create a formula like this and put it in the same section as the formula that you posted.

Shared NumberVar scrapped_Time;
scrapped_Time / 3600 * 41.56


 If you also want to use that value for something else, you'll need another formula and/or variable.  It depends on what you want to do with it.

 James
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Crystal Reports: 5 Tests for Top Performance It is complete, your masterpiece report.  Not only does it meet your customer’s expectations, it blows them out the water, all they want is beautifully summarised and displayed in a myriad of ways. …
Hello everyone, Hope you find this as helpful as we did. We have on the company I work for an application built in Delphi V with Crystal Reports 8. We all know that Crystal & Delphi can be temperamental sometimes and the worst thing is, nearly…
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
Suggested Courses

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question