Class sap.ui.model.analytics.AnalyticalBindingModule: sap/ui/model/analytics/AnalyticalBinding

extends TreeBinding

Tree binding implementation for OData entity sets with aggregate semantics.

Note on the handling of different count modes: The AnalyticalBinding always uses the OData $inlinecount system query option to determine the total count of matching entities. It ignores the default count mode set in the ODataModel instance and the count mode specified in the binding parameters. If the default count mode is None, a warning is added to the log to remind the application that OData requests generated by the AnalyticalBinding will include a $inlinecount. If a count mode has been specified in the binding parameters, an error message will be logged if it is None, because the binding will still add the $inlinecount to OData requests. If a binding count mode is set to Request or Both, a warning will be logged to remind the application that the OData requests generated by the AnalyticalBinding will include a $inlinecount.

Experimental API:This module is only for experimental use!

Constructor Summary
new sap.ui.model.analytics.AnalyticalBinding(oModel, sPath, oContext?, aSorter?, aFilters?, mParameters?)
Method Summary
sap.ui.model.analytics.AnalyticalBinding.extend(sClassName, oClassInfo?, FNMetaImpl?)Creates a new subclass of class sap.ui.model.analytics.AnalyticalBinding with name sClassName and enriches it with the information contained in oClassInfo.
sap.ui.model.analytics.AnalyticalBinding.getMetadata()Returns a metadata object for class sap.ui.model.analytics.AnalyticalBinding.
filter(aFilter, sFilterType?)Sets filters for matching only a subset of the entities in the bound OData entity set.
getAnalyticalInfoForColumn(sColumnName)Gets the analytical information for a column with a given name.
getAnalyticalQueryResult()Gets analytical metadata for the bound OData entity set.
getDimensionDetails()Gets details about the dimension properties included in the bound OData entity set.
getDownloadUrl(sFormat)Get a download URL with the specified format considering the sort/filter/custom parameters.
getFilterablePropertyNames()Gets the names of the filterable properties in the bound OData entity set.
getGroupName(oContext, iLevel)Gets a printable name for a group.
getGroupSize(oContext, iLevel)Gets the total number of contexts contained in a group, if known.
getMeasureDetails()Gets details about the measure properties included in the bound OData entity set.
getNodeContexts(mParameters)Gets child contexts for a specified parent context.
getProperty(sPropertyName)Gets the metadata of a property with a given name.
getPropertyHeading(sPropertyName)Gets the label of a property with a given name.
getPropertyLabel(sPropertyName)Gets the label of a property with a given name.
getPropertyQuickInfo(sPropertyName)Gets the quick info of a property with a given name.
getRootContexts(mParameters)Gets the context for the root aggregation level representing the grand total for all bound measure properties.
getSortablePropertyNames()Gets the names of the sortable properties in the bound OData entity set.
getTotalSize()Gets the total number of entities in the bound OData entity set.
hasAvailableNodeContexts(oContext, iLevel)Determines if the binding has the entries of a given aggregation level locally available.
hasChildren(oContext, mParameters)Determines if the contexts in a specified group have further children.
hasMeasures()Determines if any of the properties included in the bound OData entity set is a measure property.
isMeasure(sPropertyName)Determines if a given name refers to a measure property
loadGroups(mGroupIdRanges)Loads child contexts of multiple groups.
providesGrandTotal()Determines if the binding has been configured to provide a grand total for the selected measure properties.
refresh(bForceUpdate?)Refreshes the binding, check whether the model data has been changed and fire change event if this is the case.
sort(aSorter)Sets sorters for retrieving the entities in the bound OData entity set in a specific order.
updateAnalyticalInfo(aColumns)Updates the binding's structure with new analytical information.
Methods borrowed from class sap.ui.base.Object
Constructor Detail
new sap.ui.model.analytics.AnalyticalBinding(oModel, sPath, oContext?, aSorter?, aFilters?, mParameters?)
Parameters:
{sap.ui.model.Model}oModel
{string}sPath the path pointing to the tree / array that should be bound
{object}oContext? the context object for this data binding
{array}aSorter? predefined sorter/s contained in an array
{array}aFilters? predefined filter/s contained in an array
{object}mParameters? additional control parameters. Supported parameters are:
  • entitySet: if set, it explicitly specifies the entity set addressed by the last segment of the given binding path
  • useBatchRequests: if true, multiple OData requests will be wrapped into a single batch request, wherever possible
  • provideGrandTotals: if true, grand total values will be provided for all bound measure properties
  • provideTotalResultSize: if true, the total number of matching entries in the bound OData entity set will be provided
  • reloadSingleUnitMeasures: if true, the binding will check aggregated entries with multi-unit occurrences, if some measure properties have a unique unit and will trigger separate OData requests to fetch them
Exceptions:
Will throw an error if no analytic query result object could be determined from the bound OData entity set, either from an explicitly given EntitySet (via optional mParameters.entitySet argument), or by default implicitly from the binding path (see mandatory sPath argument).
Method Detail
sap.ui.model.analytics.AnalyticalBinding.extend(sClassName, oClassInfo?, FNMetaImpl?): function
Creates a new subclass of class sap.ui.model.analytics.AnalyticalBinding with name sClassName and enriches it with the information contained in oClassInfo.

oClassInfo might contain the same kind of information as described in sap.ui.model.TreeBinding.extend.

Parameters:
{string}sClassName Name of the class being created
{object}oClassInfo? Object literal with information about the class
{function}FNMetaImpl? Constructor function for the metadata object; if not given, it defaults to sap.ui.core.ElementMetadata
Returns:
{function} Created class / constructor function
sap.ui.model.analytics.AnalyticalBinding.getMetadata(): sap.ui.base.Metadata
Returns a metadata object for class sap.ui.model.analytics.AnalyticalBinding.
Returns:
{sap.ui.base.Metadata} Metadata object describing this class
filter(aFilter, sFilterType?): sap.ui.model.analytics.AnalyticalBinding
Sets filters for matching only a subset of the entities in the bound OData entity set.

Invoking this function resets the state of the binding. Subsequent data requests such as calls to getNodeContexts() will need to trigger OData requests in order to fetch the data that are in line with these filters.

Parameters:
{sap.ui.model.Filter[]|sap.ui.model.Filter}aFilter an Array of sap.ui.model.Filter objects or a single Filter instance.
{sap.ui.model.FilterType}sFilterType?, Default: sap.ui.model.FilterType.Control Type of the filter which should be adjusted.
Returns:
{sap.ui.model.analytics.AnalyticalBinding} returns this to facilitate method chaining
getAnalyticalInfoForColumn(sColumnName): object
Gets the analytical information for a column with a given name.
Parameters:
sColumnName the column name.
Returns:
{object} analytical information for the column; see updateAnalyticalInfo for an explanation of the object structure
Gets analytical metadata for the bound OData entity set.
Returns:
{sap.ui.model.analytics.odata4analytics.QueryResult} analytical metadata for the bound OData entity set
getDimensionDetails(): map
Gets details about the dimension properties included in the bound OData entity set.
Returns:
{map} details for every dimension property addressed by its name. The details object provides these properties: name of the dimension, keyPropertyName for the name of the property holding the dimension key, textPropertyName for the name of the property holding the text for the dimension, aAttributeName listing all properties holding dimension attributes, grouped as indicator whether or not this dimension is currently grouped, and analyticalInfo, which contains the binding information for this dimension passed from the AnalyticalBinding's consumer via call to function updateAnalyticalInfo.
getDownloadUrl(sFormat): string
Get a download URL with the specified format considering the sort/filter/custom parameters.

The download URL also takes into account the selected dimensions and measures, depending on the given column definitions of the AnalyticalTable. This is based on the visible/inResult flags of the columns, as well as integrity dependencies, e.g. for mandatory Unit properties.

Parameters:
{string}sFormat Value for the $format Parameter
Since:
1.24
Returns:
{string} URL which can be used for downloading
getFilterablePropertyNames(): array
Gets the names of the filterable properties in the bound OData entity set.
Returns:
{array} names of properties that can be filtered.
getGroupName(oContext, iLevel): string
Gets a printable name for a group.

The printable name follows the pattern is <label>:<key-value>[-<text-value>], where label is the label of the dimension property used at the aggregation level for the group, key-value is the key value of that dimension for the group, and text-value is the value of the associated text property, if it is also used in the binding.

Whenever a formatter function has been defined for a column displaying the key or text of this dimension, the return value of this function is applied for the group name instead of the respective key or text value.

Parameters:
{sap.ui.model.Context}oContext the parent context identifying the requested group.
{int}iLevel the level number of oContext (because the context might occur at multiple levels)
Returns:
{string} a printable name for the group.
getGroupSize(oContext, iLevel): int
Gets the total number of contexts contained in a group, if known.

For a given group, be aware that the group size might vary over time. In principle, this can happen if the bound set of OData entities includes measure properties with amount or quantity values. The AnalyticalBinding recognizes situations where the OData service returns multiple entries for a single group entry due to the fact that a measure property cannot be aggregated properly, because an amount exists in multiple currencies or a quantity exists in multiple units. In such situations, the AnalyticalBinding substitutes these entries by a single representative, and the group size gets reduced by the count of duplicate entries. Finally, since the Binding does not always fetch all children of a group at once, but only a page with a certain range, such size changes might happen after every page access.

Parameters:
{sap.ui.model.Context}oContext the parent context identifying the requested group of child contexts.
{int}iLevel the level number of oContext (because the context might occur at multiple levels)
Returns:
{int} The currently known group size, or -1, if not yet determined
getMeasureDetails(): map
Gets details about the measure properties included in the bound OData entity set.
Returns:
{map} details for every measure property addressed by its name. The details object provides these properties: name of the measure, rawValuePropertyName for the name of the property holding the raw value, unitPropertyName for the name of the property holding the related value unit or currency, if any, and analyticalInfo, which contains the binding information for this measure passed from the AnalyticalBinding's consumer via call to function updateAnalyticalInfo.
getNodeContexts(mParameters): array
Gets child contexts for a specified parent context.

Contexts are returned in a stable order imposed by the dimension property that defines this aggregation level beneath the parent context: Either a sort order has been specified for this property, or the entries are returned in ascending order of the values of this dimension property by default.

If any of the requested data is missing, an OData request will be triggered to load it.

Parameters:
{map}mParameters specifying the aggregation level for which contexts shall be fetched. Supported parameters are:
  • oContext: parent context identifying the requested group of child contexts
  • level: level number for oContext, because it might occur at multiple levels; context with group ID "/" has level 0
  • numberOfExpandedLevels: number of child levels that shall be fetched automatically
  • startIndex: index of first child entry to return from the parent context (zero-based)
  • length: number of entries to return; counting begins at the given start index
  • threshold: number of additional entries that shall be locally available in the binding for subsequent accesses to child entries of the given parent context.
Returns:
{array} Array containing the requested contexts of class sap.ui.model.Context, limited by the number of entries contained in the entity set at that aggregation level. The array will contain less than the requested number of contexts, if some are not locally available and an OData request is pending to fetch them. In this case, if the parameter numberOfExpandedLevels > 0, the array will be completely empty.
getProperty(sPropertyName): object
Gets the metadata of a property with a given name.
Parameters:
{string}sPropertyName The property name.
Returns:
{object} OData metadata of this property or null if it does not exist.
getPropertyHeading(sPropertyName): string
Gets the label of a property with a given name.
Parameters:
{string}sPropertyName The property name.
Returns:
{string} The heading maintained for this property or null if it does not exist.
getPropertyLabel(sPropertyName): string
Gets the label of a property with a given name.
Parameters:
{string}sPropertyName The property name.
Returns:
{string} The label maintained for this property or null if it does not exist.
getPropertyQuickInfo(sPropertyName): string
Gets the quick info of a property with a given name.
Parameters:
{string}sPropertyName The property name.
Returns:
{string} The quick info maintained for this property or null if it does not exist.
getRootContexts(mParameters): array
Gets the context for the root aggregation level representing the grand total for all bound measure properties.

The context is assigned to parent group ID null. If the binding is configured not to provide a grand total, this context is empty. If data for this context is not locally available yet, an OData request will be triggered to load it.

This function must be called whenever the bound set of OData entities changes, e.g., by changing selected dimensions, modifying filter conditions, etc.

Parameters:
{map}mParameters specifying how the top-most aggregation level shall be fetched. Supported parameters are:
  • numberOfExpandedLevels: number of child levels that shall be fetched automatically
  • startIndex: index of first entry to return from parent group ID "/" (zero-based)
  • length: number of entries to return at and after the given start index
  • threshold: number of additional entries that shall be locally available in the binding for subsequent accesses to contexts of parent group ID "/" or below, if auto-expanding is selected
Returns:
{array} Array with a single object of class sap.ui.model.Context for the root context, or an empty array if an OData request is pending to fetch requested contexts that are not yet locally available.
getSortablePropertyNames(): array
Gets the names of the sortable properties in the bound OData entity set.
Returns:
{array} names of properties that can be used for sorting the result entities.
getTotalSize(): int
Gets the total number of entities in the bound OData entity set.

Counting takes place at the lowest aggregation level defined by the possible value combinations for the complete set of dimension properties included in the bound entity set. This means that intermediate aggregate entities with sub-totals at higher aggregation levels are not counted.

Returns:
{int} the total number of addressed entities in the OData entity set
hasAvailableNodeContexts(oContext, iLevel): boolean
Determines if the binding has the entries of a given aggregation level locally available.

If so, no further OData request is required to fetch any of them.

Parameters:
{sap.ui.model.Context}oContext the parent context identifying the aggregation level.
{int}iLevel the level number of oContext (because the context might occur at multiple levels).
Returns:
{boolean} property of sap.ui.model.analytics.AnalyticalBinding.ContextsAvailabilityStatus, indicating whether all, some, or none of the entries are locally available.
hasChildren(oContext, mParameters): boolean
Determines if the contexts in a specified group have further children. If so, any of these group contexts can be a parent context of a nested sub-group in a subsequent aggregation level.
Parameters:
{sap.ui.model.Context}oContext the parent context identifying the requested group of child contexts.
{map}mParameters The only supported parameter is level as the level number of oContext (because the context might occur at multiple levels)
Returns:
{boolean} true if and only if the contexts in the specified group have further children.
hasMeasures(): boolean
Determines if any of the properties included in the bound OData entity set is a measure property.
Returns:
{boolean} true if and only one or more properties are measure properties.
isMeasure(sPropertyName): boolean
Determines if a given name refers to a measure property
Parameters:
{string}sPropertyName The property name.
Returns:
{boolean} true if and only if the bound OData entity set includes a measure property with this name.
loadGroups(mGroupIdRanges)
Loads child contexts of multiple groups.
Parameters:
{map}mGroupIdRanges specifies index ranges of child contexts to be loaded for multiple groups identified by their ID. A group index range is given by an object consisting of startIndex, length, threshold. For every group ID, the map holds an array of such range objects.
providesGrandTotal(): boolean
Determines if the binding has been configured to provide a grand total for the selected measure properties.
Returns:
{boolean} true if and only if the binding provides a context for the grand totals of all selected measure properties.
refresh(bForceUpdate?)
Refreshes the binding, check whether the model data has been changed and fire change event if this is the case. For service side models this should refetch the data from the service. To update a control, even if no data has been changed, e.g. to reset a control after failed validation, please use the parameter bForceUpdate.
Parameters:
{boolean}bForceUpdate? Update the bound control even if no data has been changed
Sets sorters for retrieving the entities in the bound OData entity set in a specific order.

Invoking this function resets the state of the binding. Subsequent data requests such as calls to getNodeContexts() will need to trigger OData requests in order to fetch the data that are in line with these sorters.

Parameters:
{sap.ui.model.Sorter|array}aSorter an sorter object or an array of sorter objects which define the sort order.
Returns:
{sap.ui.model.analytics.AnalyticalBinding} returns this to facilitate method chaining.
updateAnalyticalInfo(aColumns)
Updates the binding's structure with new analytical information.

Analytical information is the mapping of UI columns to properties in the bound OData entity set. Every column object contains the name of the bound property and in addition:

  1. A column bound to a dimension property has further boolean properties:
    • grouped: dimension will be used for building groups
    • visible: if the column is visible, values for the related property will be fetched from the OData service
    • inResult: if the column is not visible, but declared to be part of the result, values for the related property will also be fetched from the OData service
  2. A column bound to a measure property has further boolean properties:
    • total: totals and sub-totals will be provided for the measure at all aggregation levels

Invoking this function resets the state of the binding and subsequent data requests such as calls to getNodeContexts() will need to trigger OData requests in order to fetch the data that are in line with this analytical information.

Please be aware that a call of this function might lead to additional back-end requests, as well as a control re-rendering later on. Whenever possible use the API of the analytical control, instead of relying on the binding.

Parameters:
{array}aColumns an array with objects holding the analytical information for every column, from left to right.