Skip to main content
Inspiring
September 14, 2011
Question

sum/%

  • September 14, 2011
  • 2 replies
  • 568 views

Hi,

i have 2 count came from two queries

s1: 20

s2: 50

i want to find the % but my synstax didn't work, is there other way besides evaluate function?

<cfset percent = (s1/s2) * 100 />

thanks

This topic has been closed for replies.

2 replies

Inspiring
September 14, 2011

In addition to isaac's answer, make sure you protect yourself from division by zero errors.

ilssac
Inspiring
September 14, 2011

kt03 wrote:

<cfset percent = (s1/s2) * 100 />

This does not work for you?

There should be NO reason to use evaluate for what you want to do.

You MAY need to use more of the full record set syntax.  I.E. variable.column[row] OR variable["column"][row].