formula

1. Junior Member
Join Date
Dec 1969
Posts
27

## formula

I have a field in an access db that contains a formula <BR>for example: c * r * t<BR><BR>in the asp page c, r and t are assigned specific values.<BR><BR>how can i calculate those values on the page for each record? note: each record might have a different formula.<BR><BR>my problem is that asp keeps on showing the formula as a string..how can i get it to calculate the formula???<BR>

2. Senior Member
Join Date
Dec 1969
Posts
1,570

## what?

so, right now, <BR><BR>c = some numeric value<BR>r = some numeric value<BR>t = some numeric value<BR><BR>correct?<BR><BR>if so, then just say:<BR><BR>product = c * r * t<BR>response.write product<BR><BR>

3. Senior Member
Join Date
Dec 1969
Posts
973

## RE: formula

try eval()

4. Senior Member
Join Date
Dec 1969
Posts
973

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/script56/html/vtoriFunctions.asp

5. Junior Member
Join Date
Dec 1969
Posts
27

## RE: what?

the formula is in a field in the database<BR><BR>product = RS.Fields.Item("formula").Value<BR><BR>but then the asp page does not do the calculation but shows it as a string

6. Senior Member
Join Date
Dec 1969
Posts
1,570

## RE: what?

so for example it could look like this:<BR><BR>product = RS.Fields.Item("formula").Value<BR>product = 2*5*9 <BR><BR>if this is the case, you could split product into an array and multiply the numbers that way:<BR><BR>strProduct = (product, "*")<BR>strProduct2 = strProduct(0) * strProduct(1) * strProduct(2)<BR>response.write strProduct2

7. God
Senior Member
Join Date
Dec 1969
Posts
18,177

## What if it isn't always ..

.. multiplication? Throw in division... <BR><BR>But, I think what they are saying is that 2, 5 and 9 are NOT in the database. Just the variables A, B, and C. The variables are populated in the ASP page.

8. Senior Member
Join Date
Dec 1969
Posts
1,570

## tru...

just putting in my 2 cents GOD! I give up though...

9. God
Senior Member
Join Date
Dec 1969
Posts
18,177

## The ugly solution..

..<BR>http://www.aspmessageboard.com/forum/asp.asp?M=475571&F=20&P=1<BR>

10. Senior Member
Join Date
Dec 1969
Posts
973

## eval()

wouldn&#039;t eval() work?

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•