rbf_getViewCount

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 the number of records in a view, after applying filters, if any.

Syntax

rbf_getViewCount(viewId, callback, options);

Parameters

viewId

The original ID of the view.

callback

A function to process the specified operation and receive the record count as the first argument.

options

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

  • filtering: The filters to be applied on the view.
    "filtering": {
        "dateFilters": [{
            "field": "<integration_name_of_field>",
            "value": "<valid_date_filter_operand>"
        }],
        "filters": [{
            "field": "<integration_name_of_field>",
            "opCode": "<valid_opCode_for_field_type>",
            "value": "<value>"
        }, {
            /* Additional filters */
        }],
        "joinType": "OR|AND"
    }
    
    Note: The dateFilters is an array type and only one date filter is supported in this API. The dateFilter is not counted into the MaxFilters limit.

    See rbf_getViewPage() for more information on filtering.

If there are filters mentioned in the view definition page, the joinType is derived from the view definition page and it ignores the joinType (if any) specified on the API call.

If there are no filters defined in the view definition page, the joinType is derived from the API call. So, it is mandatory to specify the joinType in such a case.

Note: The total number of allowed filters (including those defined in the view definition) cannot exceed the shared property MaxFilters (default value 5). When sorting is specified on the API call, it overrides any sort settings on the view definition. Only 3 sort levels are allowed on the API call.

Example

The following example filters columns by amount, price, and DOB and gives the number of records in the view:

rbf_getViewCount("12345", my_callback, 
{
    "filtering": {
        "dateFilter": [{
            "field": "DOB",
            "value": "WEEK-1|WEEK"
        }],
        "filters": [
            {
                "field": "amount",
                "value": "1606",
                "opCode": "GE"
            },
            {
                "field": "price",
                "value": "102",
                "opCode": "EQ"
            }
        ],
        "joinType": "OR"
    }
 });				
			

Note: This API is supported in portals as well.