namespace sap.ui.model.odata.ODataUtils

Visiblity: public
Available since: N/A
Module: sap/ui/model/odata/ODataUtils
Application Component: CA-UI5-COR

Nodes Overview

Node Description

Methods Overview

Method Description
sap.ui.model.odata.ODataUtils.compare

Compares the given OData values based on their type. All date and time types can also be compared with a number. This number is then interpreted as the number of milliseconds that the corresponding date or time object should hold.

sap.ui.model.odata.ODataUtils.formatValue

Formats a JavaScript value according to the given EDM type.

sap.ui.model.odata.ODataUtils.getComparator

Returns a comparator function optimized for the given EDM type.

sap.ui.model.odata.ODataUtils.setOrigin

Adds an origin to the given service URL. If an origin is already present, it will only be replaced if the parameters object contains the flag "force: true". In case the URL already contains URL parameters, these will be kept. As a parameter, a sole alias is sufficient. The parameters vParameters.system and vParameters.client however have to be given in pairs. In case all three origin specifying parameters are given (system/client/alias), the alias has precedence.

Examples: setOrigin("/backend/service/url/", "DEMO_123"); - result: /backend/service/url;o=DEMO_123/

setOrigin("/backend/service/url;o=OTHERSYS8?myUrlParam=true&x=4", {alias: "DEMO_123", force: true}); - result /backend/service/url;o=DEMO_123?myUrlParam=true&x=4

setOrigin("/backend/service;o=NOT_TOUCHED/url;v=2;o=OTHERSYS8;srv=XVC", {alias: "DEMO_123", force: true}); - result /backend/service;o=NOT_TOUCHED/url;v=2;o=DEMO_123;srv=XVC

setOrigin("/backend/service/url/", {system: "DEMO", client: 134}); - result /backend/service/url;o=sid(DEMO.134)/

sap.ui.model.odata.ODataUtils.compare

Compares the given OData values based on their type. All date and time types can also be compared with a number. This number is then interpreted as the number of milliseconds that the corresponding date or time object should hold.

Param Type DefaultValue Description
vValue1 any

the first value to compare

vValue2 any

the second value to compare

bAsDecimal string false

if true, the string values vValue1 and vValue2 are compared as a decimal number (only sign, integer and fraction digits; no exponential format). Otherwise they are recognized by looking at their types.

sap.ui.model.odata.ODataUtils.formatValue

Formats a JavaScript value according to the given EDM type.

Param Type DefaultValue Description
vValue any

The value to format

sType string

The EDM type (e.g. Edm.Decimal)

bCaseSensitive boolean

Whether strings gets compared case sensitive or not

sap.ui.model.odata.ODataUtils.getComparator

Returns a comparator function optimized for the given EDM type.

Param Type DefaultValue Description
sEdmType string

the EDM type

sap.ui.model.odata.ODataUtils.setOrigin

Adds an origin to the given service URL. If an origin is already present, it will only be replaced if the parameters object contains the flag "force: true". In case the URL already contains URL parameters, these will be kept. As a parameter, a sole alias is sufficient. The parameters vParameters.system and vParameters.client however have to be given in pairs. In case all three origin specifying parameters are given (system/client/alias), the alias has precedence.

Examples: setOrigin("/backend/service/url/", "DEMO_123"); - result: /backend/service/url;o=DEMO_123/

setOrigin("/backend/service/url;o=OTHERSYS8?myUrlParam=true&x=4", {alias: "DEMO_123", force: true}); - result /backend/service/url;o=DEMO_123?myUrlParam=true&x=4

setOrigin("/backend/service;o=NOT_TOUCHED/url;v=2;o=OTHERSYS8;srv=XVC", {alias: "DEMO_123", force: true}); - result /backend/service;o=NOT_TOUCHED/url;v=2;o=DEMO_123;srv=XVC

setOrigin("/backend/service/url/", {system: "DEMO", client: 134}); - result /backend/service/url;o=sid(DEMO.134)/

Param Type DefaultValue Description
sServiceURL string

the URL which will be enriched with an origin

vParameters object string

if string then it is asumed its the system alias, else if the argument is an object then additional Parameters can be given

alias string

the system alias which will be used as the origin

system string

the system id which will be used as the origin

client string

the system's client

force string

setting this flag to 'true' overrides the already existing origin