Great! Thanks. I was able to get the Reset Form button working. I have provided the script below (I had to change the ppCurrent.getDay()== to 5 and 6 as those are the numbers for Sat and Sun in this JS). I am still doing something wrong as I move stuff around. Please see this all together and show me where to move the code you were talking about. I really appreciate your time.
for(var i=1; i<=16; i++){
Table1.resolveNode("Row" + i).Day.rawValue = "";
Table1.resolveNode("Row" + i).Date.rawValue = "";
Table1.resolveNode("Row" + i).fillColor = "255,255,255";
}
var rowNum = 1;
var nWorkDays = 0;
for(var i=pp.getDate(); i<=ppEnd.getDate(); i++){
pp.setDate(i);
var ppCurrent = new Date(pp.getFullYear(), pp.getMonth(), pp.getDate());
Table1.resolveNode("Row" + rowNum).Day.rawValue = days[ppCurrent.getDay()];
Table1.resolveNode("Row" + rowNum).Date.rawValue = (pp.getMonth()+1) + "/" + ppCurrent.getDate() + "/" + pp.getFullYear();
rowNum++;
if (ppCurrent.getDay()==5 || ppCurrent.getDay()==6){ // Weekend day (Sat or Sun)
Table1.resolveNode("Row" + rowNum).fillColor = "220,220,220"; // set background
}else{ // Work day (Mon-Fri)
nWorkDays++;
}
}
Table1.Row18.requiredHrs.rawValue = nWorkDays*8; // sets the required hours (8 hours per work day)
}
actually, ppCurrent.getDay()== to 5 and 6 correspond to Friday and Saturday, but because I had the script for coloring the background after the line incrementing row number (rowNum++), if was coloring the row after the one I intended (therefore Sunday Monday (or an empty row if the last day of the PP was a Sat or Sun.
Here is the script that should work:
//loop through pp
//clears Day and Date columns to prevent extra rows is user changes month
for(var i=1; i<=16; i++){
Table1.resolveNode("Row" + i).Day.rawValue = "";
Table1.resolveNode("Row" + i).Date.rawValue = "";
Table1.resolveNode("Row" + i).fillColor = "255,255,255"; // removes background color
}
var rowNum = 1;
var nWorkDays = 0;
for(var i=pp.getDate(); i<=ppEnd.getDate(); i++){
pp.setDate(i);
var ppCurrent = new Date(pp.getFullYear(), pp.getMonth(), pp.getDate());
Table1.resolveNode("Row" + rowNum).Day.rawValue = days[ppCurrent.getDay()];
Table1.resolveNode("Row" + rowNum).Date.rawValue = (pp.getMonth()+1) + "/" + ppCurrent.getDate() + "/" + pp.getFullYear();
// Color backgrounf if Saturday or Sunday
if (ppCurrent.getDay()==0 || ppCurrent.getDay()==6){
Table1.resolveNode("Row" + rowNum).fillColor = "220,220,220";
}else{
nWorkDays++
}
rowNum++;
}
Table1.Row18.requiredHrs.rawValue = nWorkDays*8;
}