Calculating two fields in Code

A

Aria1844

I'm new to Info Path so forgive me for the simplicity of this question. But
I'm modifying the Expense Report template and have added a few more fileds of
my own. Now I'm trying to compare two fileds to see which has the lowest
value and take that and do some calculations with it; see below! Except what
happens is that it never picks up the right value. Here I'm looking for the
lowest value, if I enter 100 for USAIDLodgingPerDiem and enter 50 for
ActualHotelCostPerNight it always takes the 100. Now enter a lower value than
100 and it works just fine! PUZZELED!!
Any assistance would be greatly appreicated.
Aria

/*
function TravelLodgeCost()
{
var USAIDLodgingPerDiem =
XDocument.DOM.selectSingleNode("//my:USAIDLodgingPerDiem");
var ActualHotelCostPerNight =
XDocument.DOM.selectSingleNode("//my:ActualHotelCostPerNight");
var NumberOfNights = XDocument.DOM.selectSingleNode("//my:NumberOfNights");
var LodgingCalculation =
XDocument.DOM.selectSingleNode("//my:LodgingCalculation");

if (USAIDLodgingPerDiem.nodeTypedValue >=
ActualHotelCostPerNight.nodeTypedVlaue){
XDocument.UI.Alert(USAIDLodgingPerDiem.nodeTypedValue);
setRoundedValue(LodgingCalculation,
getNodeTypedValue(ActualHotelCostPerNight,0,true) *
getNodeTypedValue(NumberOfNights,0,true));
}else{
XDocument.UI.Alert(USAIDLodgingPerDiem.nodeTypedValue);
setRoundedValue(LodgingCalculation,
getNodeTypedValue(USAIDLodgingPerDiem,0,true) *
getNodeTypedValue(NumberOfNights,0,true));
}


}
*/
 
S

S.Y.M. Wong-A-Ton

You may want to fix the typo in your code first and then try it again.
"ActualHotelCostPerNight.nodeTypedVlaue" should be
"ActualHotelCostPerNight.nodeTypedValue". It might make a difference...
 
A

Aria1844

That wasn't the issue! Any other suggestions?

S.Y.M. Wong-A-Ton said:
You may want to fix the typo in your code first and then try it again.
"ActualHotelCostPerNight.nodeTypedVlaue" should be
"ActualHotelCostPerNight.nodeTypedValue". It might make a difference...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top