I could use some help - I haven't been able to find any similar problems in my searches.
I have an application that is written in both Cold Fusion and Javascript. I do a query using CF code to obtain values for a series of fields on a form that are currently being calculated using data from other fields on the form. The objective is to place fixed, preloaded data in the select fields rather than use the calculated values.
The query is:
*********************************************************
*********************************************************
<cfquery name="past_bl" datasource="PRIME">
SELECT st_hr,
stlabor_l,
plc_cd
FROM TABLE_SUB
WHERE prjid='#url.prj#'
AND rev='#url.rev#'
AND ver='#url.ver#'
AND contract_id=#contract#
AND cnt_yr='#url.cyr#'
AND plc_cd = '999999'
AND st_hr > 0
AND baseline = 'N'
</cfquery>
<cfset blcount = past_bl.recordcount>
<script language="JavaScript">
bl = new Array()
alert("count is <cfoutput>#blcount#</cfoutput>")
<cfloop index = Cnt from = "1" to = #blcount#>
alert("Value is <cfoutput>#past_bl.stlabor_l[Cnt]#</cfoutput> - placed in array.")
</cfloop>
</script>
******************************************************
******************************************************
In the sample I'm working on, I have two values from the table - 245516 dollars and 281232 dollars. These represent forecasted dollars for CY1 and CY2 (CY id contract year - where CY3 is the current year.)
The code area where I'm trying to add the code to place these two values in their appropriate columns is:
********************************************************
********************************************************
// Calculate labor cost and FTEs based on number of hours entered. The logic to control prior and out years relative to the current year call this function with passed parameters - cyr and row.
function calcOutYearLaborFromHours (cyr, row)
{
hoursName = 'document.TheForm.labHoursOtherCyTot'+cyr+'_'+row
fteName = 'document.TheForm.aveFteOtherCyTot'+cyr+'_'+row
costName = 'document.TheForm.labCostOtherCyTot'+cyr+'_'+row
if(rateType == 'M3')
{
labor000 = m3RateByRow[row][cyr-1] * Number(eval(hoursName).value); // this calculation is OK
}
else // rateType is 'J5'
{
labor000 = j5RateByRow[row][cyr-1] * Number(eval(hoursName).value); // replace with table values
}
if(isNaN(labor000))
{
eval(costName).value = '---'
eval(fteName).value = '---'
}
else
{
eval(costName).value = labor000.toFixed(0)
eval(fteName).value = (Number(eval(hoursName).value) / jsProdHrsTot[cyr-1]).toFixed(4) }
}
**************************************************
**************************************************
Rather than calculate the dollar values for CY1 and CY2 as is done above, I want to use the values from the database table, TABLE_SUB. I have tried numerous things, but I'm clearly not a Javascript expert as what appears simple to some id giving me a lot of grief. If more information is needed to help understand the process I'm trying to achieve, I will be more than happy to provide what I can.
Thanks for you help - any and all will be appreciated.
Bill
Bill
lohneb@bellsouth.net
I have an application that is written in both Cold Fusion and Javascript. I do a query using CF code to obtain values for a series of fields on a form that are currently being calculated using data from other fields on the form. The objective is to place fixed, preloaded data in the select fields rather than use the calculated values.
The query is:
*********************************************************
*********************************************************
<cfquery name="past_bl" datasource="PRIME">
SELECT st_hr,
stlabor_l,
plc_cd
FROM TABLE_SUB
WHERE prjid='#url.prj#'
AND rev='#url.rev#'
AND ver='#url.ver#'
AND contract_id=#contract#
AND cnt_yr='#url.cyr#'
AND plc_cd = '999999'
AND st_hr > 0
AND baseline = 'N'
</cfquery>
<cfset blcount = past_bl.recordcount>
<script language="JavaScript">
bl = new Array()
alert("count is <cfoutput>#blcount#</cfoutput>")
<cfloop index = Cnt from = "1" to = #blcount#>
alert("Value is <cfoutput>#past_bl.stlabor_l[Cnt]#</cfoutput> - placed in array.")
</cfloop>
</script>
******************************************************
******************************************************
In the sample I'm working on, I have two values from the table - 245516 dollars and 281232 dollars. These represent forecasted dollars for CY1 and CY2 (CY id contract year - where CY3 is the current year.)
The code area where I'm trying to add the code to place these two values in their appropriate columns is:
********************************************************
********************************************************
// Calculate labor cost and FTEs based on number of hours entered. The logic to control prior and out years relative to the current year call this function with passed parameters - cyr and row.
function calcOutYearLaborFromHours (cyr, row)
{
hoursName = 'document.TheForm.labHoursOtherCyTot'+cyr+'_'+row
fteName = 'document.TheForm.aveFteOtherCyTot'+cyr+'_'+row
costName = 'document.TheForm.labCostOtherCyTot'+cyr+'_'+row
if(rateType == 'M3')
{
labor000 = m3RateByRow[row][cyr-1] * Number(eval(hoursName).value); // this calculation is OK
}
else // rateType is 'J5'
{
labor000 = j5RateByRow[row][cyr-1] * Number(eval(hoursName).value); // replace with table values
}
if(isNaN(labor000))
{
eval(costName).value = '---'
eval(fteName).value = '---'
}
else
{
eval(costName).value = labor000.toFixed(0)
eval(fteName).value = (Number(eval(hoursName).value) / jsProdHrsTot[cyr-1]).toFixed(4) }
}
**************************************************
**************************************************
Rather than calculate the dollar values for CY1 and CY2 as is done above, I want to use the values from the database table, TABLE_SUB. I have tried numerous things, but I'm clearly not a Javascript expert as what appears simple to some id giving me a lot of grief. If more information is needed to help understand the process I'm trying to achieve, I will be more than happy to provide what I can.
Thanks for you help - any and all will be appreciated.
Bill
Bill
lohneb@bellsouth.net