I have a SharePoint list called Business Days, within this list a column called 'Date' is populated with Bank Holiday Dates, i.e. 25/12/2014, 26/12/2014, etc.
Within another list I am capturing a start date and an end date and im trying to get the number of bank holidays that fall between these dates, my code currently finds the values of the start date and end date fields and sets these into variables called startdate and enddate respectively.
My code looks like this:
Its currently not working as expected, any help would be appreciated.
Thanks
Within another list I am capturing a start date and an end date and im trying to get the number of bank holidays that fall between these dates, my code currently finds the values of the start date and end date fields and sets these into variables called startdate and enddate respectively.
My code looks like this:
$().SPServices(
{
operation: "GetListItems",
async: false,
debug: true,
listName: "Business Days",
CAMLQuery: "<Where><And><Geq><FieldRef Name='Date'></FieldRef><Value Type='DateTime'>" + sd + "</Value></Geq><Leq><FieldRef Name='Date'></FieldRef><Value Type='DateTime'> + ed +
</Value></Leq></And></Where>",
CAMLViewFields: "<ViewFields></ViewFields>",
completefunc: function (xData, Status)
{
var datecount = $(xData.responseXML).SPFilterNode('z:row').length(function ()
{
$(this).attr('ows_Date');
});
alert(datecount);
}
})
Its running as a presave function returning false so it doesn't actually save at the moment, what im wanting is my variable 'datecount' to hold the number of bank holidays between the start date and end date so that if I pick a start date of 20/12/2014 and an end date of 30/12/2014, the variable datecount should hold the value of 2 (i.e. 1 for 25/12/2014 + 1 for 26/12/2014).Its currently not working as expected, any help would be appreciated.
Thanks