rbf_getPage()

Warning: Support for using this method with external objects (such as those mapped to external tables, to OpenEdge Service objects, or through a HDP connection) is a beta feature. This method is supported in production systems, except for external objects.

Purpose

This function fetches a set of records in a view, including (optionally) dependent records. It brings info back to the page using an asynchronous AJAX mechanism. The amount of processing and time required to get complete results can vary widely, depending on whether it fetches related records and the number of rows you specify per page.

For pages containing fields that allow values in multiple languages, you can use the options parameter to specify the language in which to return the values. If the values are not available in the specified language, it will return the values for the tenant's base language. If the specified language is not configured for the tenant, it will throw an error. To use the options parameter, you must also provide values for the onlyViewFields and useLegacyDateFormat parameters.

Only records on which the current user has View permission on the selected object type(s) will be fetched.

Syntax

rbf_getPage(viewId, startRow, rowsPerPage, composite, objNames, fieldList, callback, onlyViewFields, useLegacyDateFormat, options)

Parameters

viewId

The original ID of the view

startRow

The row to start fetching records from (0 by default)

rowsPerPage

The maximum number of row to fetch in one call (user-specified value by default)

composite

The depth of recursion of dependent records to fetch (0 by default)

objNames

A comma-separated list of dependent object names to fetch (use "*" for all objects - default value)

fieldList

A comma-separated list of field names to fetch (use "*" for all fields - default value)

callback

A callback function that will receive an array of fetched records as first parameter

onlyViewFields

When true, the output only includes fields in the specified view. When false, the output includes all fields in the object definition.

useLegacyDateFormat

This optional parameter only applies to JSON output and, specifically, to Date and Date/Time fields. If true, or if not specified, a date value is returned as a Date object. If false, a date value is returned as a String.

options

An optional JSON object that sets the values of optional arguments. The properties that this object can take are as follows:

  • langCode to a valid two-letter ISO language code, for example, {"langCode":"es"}
  • useISODateFormat to get the date or date/time values in ISO format, for example, {"useISODateFormat":true}.
    • If the date and time value is Mon Jul 30 00:01:00 IST 2018 its equivalent ISO formatted value 2018-07-29T18:31:00Z- is returned.
    • If the date value is Mon Jul 30 2018, its equivalent ISO formatted value 2018-07-30 is returned.

Note:
  • This API is supported in portals as well.
  • If both useLegacyDateFormat and useISODateFormat are set to true, useISODateFormat is applied.

Example

The following example fetches set or rows and processes results in a loop:

function my_callback(arr) {
        for (var k=0; k<arr.length; k++) {
          var amount = arr[k]['amount'];
          var price = arr[k] [‘price'];
          // Do something...
          }
          }
          
          rbf_getPage("123456", 0, 100, null, null, "amount,price", my_callback);