This field contains a calculation error.
References: Transportation Expenses Date
The collection contains:
Date picker (Date)
Numeric (Miles Traveled)
Outside the collections I have several hidden fields.
Active Mileage Rate
Current Mileage Rate
Next Mileage Rate
Next Rate Date
The calculation I am trying to perform in the Active Mileage Rate is a date comparison between Next Mileage rate and the Date selected by the traveler. If it's less the Active Date will contain the Current Mileage Rate and if >= it will contain the Next Mileage Rate.
Within in the collection in the Amount field, the calculation is (Active Mileage Rate * Miles Traveled)
After playing around with this I realized that I cannot use
=INDEX(Transportation_Expenses.DateTransportation,ROW())
outside of the collection because the ROW() always returns 0
I tried to to this in javascript but new rows added to the collection don't seem to have event handlers.
$('.TransportationDate').change(function(){
var SelectedDate = $(this).find('[id^=Field11]').val();
var NextRateDate = $('.NextRateChange input').val();
var CurrentMileageRate = $('.CurrentMileageRate input').val();
var NextMileageRate = $('.NextMileageRate input').val();
var ActiveMileageRate;
alert(SelectedDate + " " + NextRateDate + " " + CurrentMileageRate + " " + NextMileageRate);
if (SelectedDate >= NextRateDate) {
ActiveMileageRate = CurrentMileageRate;
} else {
ActiveMileageRate = NextMileageRate;
}
// $('.test2 input').val(ActiveMileageRate);
//});
});
This change event will only fire for rows that were already added, but not new rows added by the user.