Solved

How to find a rate

Posted on 2011-09-13
6
365 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
6 Comments
 
LVL 34

Expert Comment

by:johnsone
Comment Utility
The rate should be:

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

0
 
LVL 34

Expert Comment

by:johnsone
Comment Utility
Sorry, missed a decimal place:

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

Expert Comment

by:mlmcc
Comment Utility
Or just

  (dur/3660) * 41.56

mlmcc
0
Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

 
LVL 51

Expert Comment

by:HainKurt
Comment Utility
"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 100

Accepted Solution

by:
mlmcc earned 125 total points
Comment Utility
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 34

Expert Comment

by:James0628
Comment Utility
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

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

I hate sub reports and always consider them the last resort in any reporting solution.  The negative effect on performance and maintainability is just not worth the easy ride they give the report writer.  Nine times out of ten reporting requirements…
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…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…

772 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now