Is there any documentation for SPJS-Utility functions

Home Forums SPJS-Utility Is there any documentation for SPJS-Utility functions

Viewing 2 reply threads
  • Author
    Posts
    • #10801
      Jeff Law
      Participant

        Hi,
        I was just wondering if there was any documentation on SPJS-Utility functions. I haven’t been able to find anything (I may need extra tuition on how to use search :-))

        I have a requirement to add information from some other lists, which all share a common “ID” field, onto a new tab in the “master” list. There are currently 5 of these lists that I need to query, and display information from. Once displayed, then this info can be printed.

        I have found reference to the spjs.utility.queryItems function which sounds like it will do all the heavy lifting for me, but I am not sure of the best way to drive it, so was looking for some reference, or an example.

        Regards
        Jeff

      • #10826
        Alexander Bautz
        Keymaster

          Hi,
          No, I have never gotten around to document these functions, but the queryitems function can basically be used like this:

          var res = spjs_QueryItems(
          	{
          		"listName":"DFFS_TestList",
          		"listBaseUrl":"/DFFS",
          		"query":"<Where><Eq><FieldRef Name='Title' /><Value Type='Text'>Test</Value></Eq></Where>",
          		"viewFields":["ID","Title","Author","Created"]
          	}
          );
          $.each(res.items,function(i,item){
          	console.log(item.Title+" was created on "+new Date(item.Created).toLocaleDateString()+" by "+item.Author.split(";#")[1]);
          });

          Change the parameters “listName”, “listBaseUrl”, “query” and “viewFields” to match your setup.

          When this is said, It sounds like you might be better off using vLookup? – have you looked at this options?

          Alexander

        • #10843
          Jeff Law
          Participant

            Thanks Alexander. I’ll give this a go.

            I have used vLookup in another place, but what I was looking for was something that I could easily use some custom css/html to format the fields in a specific way. The ideal output that gets printed would look something like a fully “branded” certificate.

            I haven’t looked to hard at what I can do with regard to the output of vLookup, so it is an option. At least if I can get the info using the QueryItems, then I can use that as a starting point/fallback position.

            I’ll let you know how I go, and once again thanks for you response.

            Regards
            Jeff

        Viewing 2 reply threads
        • You must be logged in to reply to this topic.