Re: math
On Jul 24, 12:35 pm, "chrispilie" <webforumsu...@macromedia.com>
wrote:
> I am trying to do some simple math equations with data from a query. This is
> what it may look like.
>
> #queryname.VariableA*#(#queryname.VariableB#/#quer yname.VariableC#) Is there
> any ideas?
>
> I can get these to work when setting them within a query of query but when I
> loop the variables they populate every value with its associated column. Here
> is the example:
>
> <CFQUERY NAME="GetEarned" DBTYPE="query">
> SELECT
> TaskDesc.QTYComplete AS QTYComplete,
> TaskDesc.Manhours AS Manhours,
> (TaskDesc.Manhours *(TaskDesc.QTYComplete / TaskDesc.QTY)) AS Earned,
> (TaskDesc.QTYComplete / TaskDesc.QTY) AS PercentComplete
> FROM TaskDesc
> </CFQUERY>
>
> ------------------------------------------
> <!--- Add JSA Task --->
> </TR><br>
> <CFLOOP QUERY="TaskDesc" startrow="#URL.StartRow#"
> endrow="#EndRow#"><cfoutput>
> <TR>
> <!--- Cust name --->
> <TD><table width="550" border="1" bordercolor="FFFFFF"
> cellspacing="0" cellpadding="0">
> <tr>
> <td width="100" align="center"><font size="-1">#ActivityID#</font></td>
> <td width="200" align="center"bgcolor="FFFFFF"><font
> size="-2">#ActivityDescription#</font></td>
> <td width="50" align="center"><font size="-2">
>
> <cfif GetEarned.QTYComplete IS "0">0
> <cfelse>#GetEarned.Earned#</cfif>
>
> </font></td>
> <td width="50" align="center"><font size="-2">#Manhours#</font></td>
> <td width="50" align="center"bgcolor="FFFFFF"><font size="-1"
> color="006633">
>
> <cfif GetEarned.QTYComplete IS "0">0
> <cfelse>#GetEarned.PercentComplete#</cfif>
>
> </cfoutput></cfloop>
>
> I did get rid of some html code to clean it up a bit.
BTW:
<cfloop query="queryName" ...>
<cfoutput>
....
</cfoutput>
</cfloop>
can be replaced with shorter
<cfoutput query="queryName" ...>
....
</cfoutput>
|