0

My SharePoint list has many Date columns, (Date1, Date2, Date3...). I would like to work on one column at a time. Is it possible, Using SPServices, to loop through each column containing (Date) one after the other?

1

You'd have to make a few calls to piece it all together. You can get all your date fields by using GetList

$().SPServices({
  operation: "GetList",
  listName: "YOURLIST",
  completefunc: function(xData, Status) {

    $(xData.responseXML).find("Fields > Field").each(function() {
      // attr Type would be DateTime
      // attr StaticName would be what you'd want to use to build up code
      var $node = $(this);
      console.log( "Type: " + $node.attr("Type") + " StaticName: " + $node.attr("StaticName") );
    });
  }
});

So you could:

1. Get list of all date field names and store in array or whatever.
2. Use that array to build up your viewFields string for the call
3. Select the items you need in the basic `GetListItems`
4. Use that array to loop through the date fields to do your logic.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.