Isaac
asked on
Working with SharePoint Data
When using JavaScript in SharePoint and dealing with items/rows of data from a few hundred to thousands, what is the best and most efficient and fastest way to work with the data? Should it be dumped in an array and worked with that way or .......?
How do you SharePoint developers or even database developers programmatically deal with thousand of rows/items of data?
How do you SharePoint developers or even database developers programmatically deal with thousand of rows/items of data?
Use SharePoint API. You shouldn't be attempting to interact with large chunks of data in the DOM (web page) when you have access to it via an API. I use SharePoint API to work with data in C#. If you have reason to interact with it on the client side (i.e. JavaScript), there is a JavaScript API. If you do not have a reason to interact on the client side, server side (C#, for example) will likely be more efficient.
ASKER
if I use JSOM or Rest API and I'm working with 8,000 list items, do I work with it directly or pull data into an array and work with it from the array? What's the best way?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks! Makes sense.
ASKER
Let's say I have 8,000 items in my SharePoint list and all I want to do is create some type of dashboard that visualizes the data in different way as in pie, bar, line charts, etc. Sometimes, the page can load a little slow depending on the number of items that's being calculated in building the chart. Any recommendations or suggestions?
Is your dashboard showing a visualization of all 8000 records? Or does it aggregate those 8000 records ? For example, in a pie chart, you are summarizing / aggregating data into categories and then showing a chart based on the result of that aggregated data. You should offload the calculations to server side and then pass the aggregated result set to JS for visualization.
You may even be able to handle that in SharePoint using a summarized view. Going back to the pie chart example, you could create a list view that summarizes the 8000 records into the categories you're using in your pie chart, and then use JavaScript API to get the data from that summarized list view.
You may even be able to handle that in SharePoint using a summarized view. Going back to the pie chart example, you could create a list view that summarizes the 8000 records into the categories you're using in your pie chart, and then use JavaScript API to get the data from that summarized list view.
ASKER
Are you saying, as an example, if I have a list of 8000 items and the categories are 'Pencil'(3000 items), 'Pen(2000 items)', and 'Eraser(3000 items)', I could summarize it in the list? Is this by using group by?
That's exactly what I'm saying. My thought was that you could break the categories into their own columns (one column for Pencils, one for Pens, one for Erasers) and then count the records in each column using the Total option in the view settings. But I just set up an example in my SharePoint environment, and I realize this isn't going to work. List Views don't limit the number of records when they summarize. All of the list items are still in the view.
So, Data View Web Part may be able to summarize the data. It's been awhile since I've played around with it, but it might be worth looking into. Or, as I said before, use a server-side language like C# to summarize the data.
Here's a blog that gives an example using JS API. They're using arrays, but the lists are small. You really don't have many options if you need all 8000 records in JS.
So, Data View Web Part may be able to summarize the data. It's been awhile since I've played around with it, but it might be worth looking into. Or, as I said before, use a server-side language like C# to summarize the data.
Here's a blog that gives an example using JS API. They're using arrays, but the lists are small. You really don't have many options if you need all 8000 records in JS.