wood burning stoves*
The moose likes HTML, CSS and JavaScript and the fly likes Calculation. .................... Please Help Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Calculation. .................... Please Help" Watch "Calculation. .................... Please Help" New topic
Author

Calculation. .................... Please Help

Joel Ogbueli
Greenhorn

Joined: Aug 24, 2003
Posts: 7
Please Could somebody help me out on translate the following cal.
formula to java function (in array)

1.)
If IsNull(x_LowOperatingRange.value) OR x_LowOperatingRange.value = "NA"
OR ((InStr(x_DeviceID.value, "PSH") > 0) And x_HighOperatingRange.value
<= 30 Then
PRE_SetPointPressure_.value + 5
ElseIf ((InStr(x_DeviceID.value, "PSH") > 0) And Round(x_HighOperatingRange.value * 1.15,0) > x_MAWP.value * 0.95 Then
PRE_SetPointPressure_.value = x_MAWP.value * 0.95
ElseIf ((InStr(x_DeviceID.value, "PSH") > 0) Then
PRE_idSetPointPressure_.value = Round(1.15 * x_HighOperatingRange.value,0)
ElseIf IsNull(x_LowOperatingRange.value) OR x_LowOperatingRange.value = "NA" OR ((InStr(x_DeviceID.value, "PAH") > 0) And Round(1.075 * x_HighOperatingRange.value,0) > 0.95 * x_MAWP.value Then
PRE_idSetPointPressure_.value = x_MAWP.value * 0.95
ElseIf ((InStr(x_DeviceID.value, "PAH") > 0) Then
PRE_SetPointPressure_.value = Round(1.075 * x_HighOperatingRange.value,0)
ElseIf IsNull(x_HighOperatingRange.value) OR x_LowOperatingRange.value
= "NA" OR ((InStr(x_DeviceID.value, "PSL") > 0) And x_LowOperatingRange.value <= 30 Then
PRE_SetPointPressure_.value = x_LowOperatingRange.value - 5
ElseIf ((InStr(x_DeviceID.value, "PSL") > 0) And x_LowOperatingRange.value
>= 31 Then
PRE_SetPointPressure_.value = Round(x_LowOperatingRange.value * 0.85,0)
ElseIf IsNull(x_HighOperatingRange.value) OR x_LowOperatingRange.value = "NA" OR ((InStr(x_DeviceID.value, "PSH") > 0) Then
PRE_SetPointPressure_.value = Round(0.925 * x_LowOperatingRange.value,0)
End If
Thanxs in advance
Joel Ogbueli
Greenhorn

Joined: Aug 24, 2003
Posts: 7
Please could anybody help me with Array....... I am so confused

function calculation(){
if( !x_LowOperatingRange.value || x_LowOperatingRange.value==="NA" || (x_DeviceID.value.match("PSH")) && x_HighOperatingRange.value <= 30) {
PRE_SetPointPressure_.value + 5;
}
else if(x_DeviceID.value.match("PSH")) && Math.floor(x_HighOperatingRange.value) * 115/100) > x_MAWP.value * 0.95) {
PRE_SetPointPressure_.value = x_MAWP.value * 0.95;
}
else if(x_DeviceID.value.match("PSH")) {
PRE_idSetPointPressure_.value = Math.floor(x_HighOperatingRange.value) * 115/100);
}
if( !x_LowOperatingRange.value || x_LowOperatingRange.value==="NA" || (x_DeviceID.value.match("PAH")) && Math.floor(x_HighOperatingRange.value)*107.5/100) > 0.95 * x_MAWP.value) {
PRE_idSetPointPressure_.value = x_MAWP.value * 0.95;
}
else if(x_DeviceID.value.match("PAH")) {
PRE_SetPointPressure_.value = Math.floor(x_HighOperatingRange.value)*107.5/100);
}
if( !x_x_HighOperatingRange.value || x_HighOperatingRange.value==="NA" || (x_DeviceID.value.match("PSL")) && x_LowOperatingRange.value <= 30) {
PRE_SetPointPressure_.value = x_LowOperatingRange.value - 5;
}
else if(x_DeviceID.value.match("PSL")) && x_LowOperatingRange.value >= 31) {
PRE_SetPointPressure_.value = Math.ceil(x_LowOperatingRange.value)*85/100);
}
if( !x_x_HighOperatingRange.value || x_x_HighOperatingRange.value==="NA" || (x_DeviceID.value.match("PAL"))) {
PRE_SetPointPressure_.value = Math.ceil(x_LowOperatingRange.value)*92.5/100);
}
}
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
you have three equal signs in a row
_LowOperatingRange.value==="NA"
should be 2
Joel Ogbueli
Greenhorn

Joined: Aug 24, 2003
Posts: 7
Please anybody help out on how to echo Ext_Record_count (record count Number) into the below function from the form

function calculation() {
for (num=0; num< <%=Ext_Record_Count%>; num++) {
if( !x_LowOperatingRange.value || x_LowOperatingRange.value=="NA" || (document.getElementById('PRE_DEVICEID_'+num).value.match("PSH")) && x_HighOperatingRange.value <= 30) {
document.getElementById('PRE_SetPointPressure_'+num).value + 5;
}
else if(document.getElementById('PRE_DEVICEID_'+num).value.match("PSH")) && Math.floor(x_HighOperatingRange.value) * 115/100) > x_MAWP.value * 0.95) {
document.getElementById('PRE_SetPointPressure_'+num).value = x_MAWP.value * 0.95;
}
else if(document.getElementById('PRE_DEVICEID_'+num).value.match("PSH")) {
document.getElementById(PRE_SetPointPressure_.value = Math.floor(x_HighOperatingRange.value)) * 115/100);
}
if( !x_LowOperatingRange.value || x_LowOperatingRange.value=="NA" || (document.getElementById('PRE_DEVICEID_'+num).value.match("PAH")) && Math.floor(x_HighOperatingRange.value)*107.5/100) > (0.95 * x_MAWP.value)) {
document.getElementById('PRE_SetPointPressure_'+num).value = x_MAWP.value * 0.95;
}
else if(document.getElementById('PRE_DEVICEID_'+num).value.match("PAH")) {
document.getElementById('PRE_SetPointPressure_'+num).value = Math.floor(x_HighOperatingRange.value)*107.5/100);
}
if( !x_HighOperatingRange.value || x_HighOperatingRange.value=="NA" || (document.getElementById('PRE_DEVICEID_'+num).value.match("PSL")) && x_LowOperatingRange.value <= 30) {
document.getElementById('PRE_SetPointPressure_'+num).value = x_LowOperatingRange.value - 5;
}
else if(document.getElementById('PRE_DEVICEID_'+num).value.match("PSL")) && x_LowOperatingRange.value >= 31) {
document.getElementById('PRE_SetPointPressure_'+num).value = Math.ceil(x_LowOperatingRange.value)*85/100);
}
if( !x_HighOperatingRange.value || x_HighOperatingRange.value=="NA" || (document.getElementById('PRE_DEVICEID_'+num).value.match("PAL"))) {
document.getElementById('PRE_SetPointPressure_'+num).value = Math.ceil(x_LowOperatingRange.value)*92.5/100);
}
}
}
This is the form
*************
<tr id="trow_<%=Ext_Record_Count%>" name="ntrow_<%=Ext_Record_Count%>">
<td class="data" height="58" bgcolor="#F5F5F5"> <input type="text" id="PRE_idDEVICEID_<%=Ext_Record_Count%>" name="PRE_DEVICEID_<%=Ext_Record_Count%>" value="<%=trim(Rs_Ext("DEVICEID")) %>" size=15 maxlength=10>
</td>
<td class="data" bgcolor="#F5F5F5"> <input type="text" id="PRE_idSETPOINTPRESSURE_<%=Ext_Record_Count%>" name="PRE_SETPOINTPRESSURE_<%=Ext_Record_Count%>" value="<%=trim(Rs_Ext("SETPOINTPRESSURE")) %>"size=6 maxlength=8>
</td>
<td class="data" bgcolor="#F5F5F5"> <input type="text" id="PRE_idFOUNDPRESSURE_<%=Ext_Record_Count%>" name="PRE_FOUNDPRESSURE_<%=Ext_Record_Count%>" value="<%=trim(Rs_Ext("FOUNDPRESSURE")) %>" size=6 maxlength=8>
</td>
<td class="data" bgcolor="#F5F5F5"> <input type="text" id="PRE_idLEFTPRESSURE_" name="PRE_LEFTPRESSURE_<%=Ext_Record_Count%>" value="<%=trim(Rs_Ext("LEFTPRESSURE")) %>" size=6 maxlength=8 onBlur="CyJS_Utils_isNumber(this);">
</td>
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Calculation. .................... Please Help
 
Similar Threads
Error in JSP : The end tag "</menu:ddmenu" is unbalanced
Automated Regression Testing suite
Displaying all the months in the year
problem with "group by"
dynamically create href link