NSOA.listview.data(listviewId)
Use this function to read the published list view data available to the user running the script. The function returns a specialized list view data iterator (length, index, next, each).
-
The data read by your scripts is the same as the data you can see in your list view at any given time.
-
Accessing published list views using the
NSOA.listview.data(listviewId)
andNSOA.listview.list()
user scripting functions does not use any of your allocated OData requests. -
For more information, see Business Intelligence Connector. See also OData Explorer to browse available OData resources and get started with a sample code, and NSOA.report.data(reportId,optionalParameters) to read published report data.
Use published list views like custom queries and read only the necessary list view data in your OpenAir scripts.
Both form and scheduled scripts support the NSOA.listview.data(listviewId)
function. However, the number of items you can process in form scripts is restricted by the scripting governance time limits. The function is best suited for reading published list view data in scheduled scripts, which allow up to 1 hour of JS runtime and 1 hour of web services API call time. For more information about scripting limits, see Scripting Governance.
The Business Intelligence Connector feature must be enabled for your account to use NSOA.listview and NSOA.report functions. The Business Intelligence Connector feature is a licensed add-on. To enable this feature, contact your OpenAir account manager.
For more information about publishing list views and reports to the OpenAir OData service, see Business Intelligence Connector.
Parameters
-
listviewId
— the published list view OData resource ID (integer).
Returns
-
A specialized list view data iterator (length, index, next, each).
-
length
— number of items -
index
— index of last returned item -
next
— returns either the next item from the iterator or “undefined” when the iterator is done -
each
— calls the specified function for each item in the iterator
-
Units Limit
-
10 units for each 1000-item page loaded into iterator on-demand. Consumes 10 units for the first fetch even when the page is empty.
Since
-
April 18, 2020
Example
// get the iterator for listview data, it has following members
// it consumes 10 units for each 1000-item page loaded into iterator on-demand
// * 'length' - number of items
// * 'index' - index of last returned item
// * 'next' - returns next item from iterator or undefined when iterator is done
// * 'each' - calls specified function for each item in the iterator
var iterator = NSOA.listview.data(7);
// get number of listview records
var row_count = iterator.length;
// grab first two records
var first = iterator.next();
var second = iterator.next();
// process rest of the listview
iterator.each(function(record, index) {
// search for particular name
if (record.Name === "Nathan Brown") {
// set the field value
NSOA.form.setValue("remaining_budget__c", record["Remaining Budget"]);
// stop iterating
return false;
}
});