Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

CF Question "Newbie"

Status
Not open for further replies.

WebGodiva

Technical User
Joined
Jun 21, 2000
Messages
263
Location
US
I have two fields on one form that I need to run calculations on.

1. Current Annual Salary x 2080 = Rate
2. Old Annual Salary x 2080 = Rate

Then I need to divide the old rate by the new rate to determine the precentage of increase.

I have no idea how to do this in CF or if it is even possible.

The result of the second calculation (the & increase) will show in the results.cfm page.

Any ideas?

Thanks in advance for your help. Hope this helped!
 
<cfset Current_Annual_Salary=25000>
<cfset Old_Annual_Salary=20000>

<cfset rate_Current = Current_Annual_Salary*2080>
<cfset rate_Old = Old_Annual_Salary*2080>

<cfset Increase_Percentage = rate_Old/rate_Current>

Increase Percentage: <cfoutput>#Increase_Percentage#</cfoutput> Sylvano
dsylvano@hotmail.com
 
looks great, one question, can I set the current_annual_salary to receive the input from the form?

i.e.,
<cfset rate_Current = #form.rate_Current#*2080>

Thanks Hope this helped!
 
but ofcourse you can... Sylvano
dsylvano@hotmail.com
 
You can use the <CFSET> to help you in your calculation.

<CFSET rate1 = 1234>
<CFSET rate2 = 4567>
<CFSET rate = rate1 / rate2>

Try it out
 
Thanks bunches!!! Hope this helped!
 
Status
Not open for further replies.

Similar threads

Part and Inventory Search

Sponsor

Back
Top