A collection is simply a Table of values.
- Collections have rows, columns and cells just like a table in Excel does
- All values in a column must be of the same data type (example: text, number, date, true/false)
- The maximum number of rows that can be imported into a collection at once is 500 rows by default but this can be increased to 2,000 by changing the delegation limit
We can visualize a Collection as a table:
City | Continent | Country |
New York | North America | USA |
London | Europe | United Kingdom |
Kyoto | Asia | Japan |
Osaka | Asia | Japan |
Los Angeles | North America | USA |
Paris | Europe | France |
Birmingham | Europe | United Kingdom |
The code to create a Collection looks like this:
//Create a collection
ClearCollect(myCities1,
{City: "New York", Country: "USA", Continent: "North America"},
{City: "London", Country:"United Kingdom", Continent: "Europe"},
{City: "Kyoto", Country: "Japan", Continent: "Asia"},
{City: "Osaka", Country: "Japan", Continent: "Asia"},
{City: "Los Angeles", Country: "USA", Continent: "North America"},
{City: "Paris", Country: "France", Continent: "Europe"},
{City: "Birmingham", Country:"United Kingdom", Continent: "Europe"}
);
More collections facts:
- A collection can be created from the values in a SharePoint List, Excel Spreadsheet, SQL, CDS or any other datasource
- Collections only exist while an app is running. When the app is closed the data stored in a collection no longer exists.
- Rows from a collection can be inserted back into the original datasource to change its values
- Galleries, Forms and Data Tables can use a collection as the datasource
- Using collections as a datasource can reduce loading times because data is stored on the local device rather than in the cloud.
- Once a collection is created it can be accessed from any screen.