Trying to take a range of month/date to utilize in calculation below...
var d = new Date(this.rawValue);
YearTraveled.rawValue = d.getYear()+1900
if (this.resolveNode("YearTraveled").rawValue == "2020") {
this.resolveNode("TravelReimbursement").rawValue = ".575";
}
if (this.resolveNode("YearTraveled").rawValue == "2021") {
this.resolveNode("TravelReimbursement").rawValue = ".560";
I want the next action to say...
if MonthTraveled is (July 2022 thru December 2022)
this.resolveNode("TravelReimbursement").rawValue = ".625";
Solved! Go to Solution.
Views
Replies
Total Likes
Try this
var d = new Date(this.rawValue); YearTraveled.rawValue = d.getFullYear(); MonthTraveled.rawValue = d.getMonth() + 1; TravelReimbursement.rawValue = ""; if (YearTraveled.rawValue == "2020") { TravelReimbursement.rawValue = ".575"; } else if (YearTraveled.rawValue == "2021") { TravelReimbursement.rawValue = ".560"; } else if (YearTraveled.rawValue == "2022") { if ((MonthTraveled.rawValue >= 7) && (MonthTraveled.rawValue <= 12)) { TravelReimbursement.rawValue = ".625"; } }
Try this
var d = new Date(this.rawValue); YearTraveled.rawValue = d.getFullYear(); MonthTraveled.rawValue = d.getMonth() + 1; TravelReimbursement.rawValue = ""; if (YearTraveled.rawValue == "2020") { TravelReimbursement.rawValue = ".575"; } else if (YearTraveled.rawValue == "2021") { TravelReimbursement.rawValue = ".560"; } else if (YearTraveled.rawValue == "2022") { if ((MonthTraveled.rawValue >= 7) && (MonthTraveled.rawValue <= 12)) { TravelReimbursement.rawValue = ".625"; } }
Good morning.
This works up until the last condition. Probably something small I'm missing. Is there a way I can share my file for you to review?
Have you got a field named MonthTraveled ?
You could just use variables as well.
Actually not sure what the preferred method of sharing files is on this forum.
Yes, I have a field named MonthTraveled
Made a slight change and it worked....
var d = new Date(this.rawValue);
YearTraveled.rawValue = d.getYear()+1900;
MonthTraveled.rawValue = d.getMonth() +1;
TravelReimbursement.rawValue = "";
if (YearTraveled.rawValue == "2020") {
TravelReimbursement.rawValue = ".575";
}
else if (YearTraveled.rawValue == "2021") {
TravelReimbursement.rawValue = ".560";
}
else if ((YearTraveled.rawValue == "2022") && (MonthTraveled.rawValue <= 6)) {
TravelReimbursement.rawValue = ".585";
}
else if ((YearTraveled.rawValue == "2022") && (MonthTraveled.rawValue >= 7)) {
TravelReimbursement.rawValue = ".625";
}
Team work...
Views
Likes
Replies
Views
Likes
Replies