Xplain.Db.Attribute
- Xplain.Db.Attribute(conf)
This class represents a Xplain Attribute.
clearSelection
- clearSelection([settings])
Clears a selection set on this attribute.
- Parameters
(optional) (function settings.error=f(data){throw new Xplain.Db.Exception}) – A set of key/value pairs that configure the clearSelection request. All settings are optional. A default can be set using the
Xplain.Db.Configuration.setDefaults()
method.(optional) – The name of the selection set for which you would like to clear the selection. Defaults to
globalSelections
.(optional) – defines if the request sent to the backend should be asynchronous or synchronous.
(optional) – defines if the request should support CORS (note: the backend also has to enable CORS requests).
(optional) – The URL used for this request.
(optional) – number of milliseconds until a timeout will be triggered.
(optional) – function what will be triggered if the Xplain Data backend reports an HTTP Status Code 200. The first parameter passed to this function will be the resulting data.
(optional) – function what will be triggered if the Xplain Data backend reports anything but a HTTP Status Code 200. The first parameter passed to this function will be an instance of the data returned by the backend.
findStates
- findStates(lookupString[, settings])
Finds all states below this attribute with a given name. Returns
false
if no matches could be found. Otherwise, it returns an array of states (an array ofXplain.Db.State
instances) which either contain thelookupString
or consist of child states which contain thelookupString
. Use thegetStates()
method of {Xplain.Db.State} to traverse through all hits.- Parameters
lookupString (string) – the result will contain of an array of states which consist of this string.
(optional) (function settings.error=f(data){throw new Xplain.Db.Exception}) – A set of key/value pairs that configure the findStates request. All settings are optional. A default can be set using the
Xplain.Db.Configuration.setDefaults()
method.(optional) – defines if the request sent to the backend should be asynchronous or synchronous.
(optional) – defines if the request should support CORS (note: the backend also has to enable CORS requests).
(optional) – The URL used for this request.
(optional) – number of milliseconds until a timeout will be triggered.
(optional) – function what will be triggered if the Xplain Data backend reports an HTTP Status Code 200. The first parameter passed to this function will be an be an array of
Xplain.Db.State
instances.(optional) – function what will be triggered if the Xplain Data backend reports anything but a HTTP Status Code 200. The first parameter passed to this function will be an instance of the data returned by the backend.
- Returns
{array|false} An array of {Xplain.Db.State} instances or boolean
false
if no matches could be found.
getDimension
- getDimension()
Synonym for getParent(). Returns this attributes parent dimension
- Returns
{Xplain.Db.Dimension} this attributes parent dimension
getDisplayName
- getDisplayName()
Returns the displayName of this attribute.
- Returns
{string} displayName of this attribute
getHierarchy
- getHierarchy()
returns an array of hierarchy level names assigned to this attribute or null, if this attribute has no hierarchies. Returns something like
["ATC Level 1","ATC Level 2","ATC Level 3","ATC Level 4","Product","PZN"]
- Returns
{Array} array of hierarchy level names.
getId
- getId()
Returns the ID of this attribute. The ID of this attribute is the concatenation of the ID of this attribute’s parent dimension and this attribute’s ID. NOTE: this method will return the ID in escaped form, e.g. if the name of this element contains a dot, this dot will be escaped.
If you prefer the verbose version of the ID, you may also use the
getVerboseId()
method.- Returns
{string} the ID of this attribute
getName
- getName()
Returns the short ID (aka name) of this attribute.
- Returns
{string} name of this attribute
getObject
- getObject()
Returns the object this attribute belongs to.
- Returns
{Xplain.Db.Object} the object this attribute belongs to
getParent
- getParent()
returns this attributes parent dimension
- Returns
{Xplain.Db.Dimension} this attributes parent dimension
getPath
- getPath()
Returns the path which leads to this attribute, i.e. the path through the raw JSON object returned by the backend.
- Returns
{Array} path which leads to this attribute
getRawData
- getRawData()
Returns this attribute’s data as it has been returned by the backend, i.e. “raw”.
- Returns
{Object} This attribute’s data as it has been returned by the backend
getSelection
- getSelection([selectionSet])
Returns a list of all selections set on this attribute. NOTE: Currently, only global selection will be considered. Thus, the
type
parameter will always be set toglobal
.- Parameters
(optional) (string selectionSet) – the selectionSet for which this method should return the selections. Defaults to
globalSelections
- Returns
{array | boolean}
false
if no selections are set on this attribute. Otherwise an array of all selections set on this attribute will be returned.
getSession
- getSession()
Returns the session to which this attribute belongs.
- Returns
{Xplain.Db.Session} the session to which this attribute belongs
getStates
- getStates([settings])
Returns an array of all direct descending states of this attribute. If not yet fetched, this triggers an ajax request to fetch all states. If already fetched once, this simply returns an array of Xplain.Db.State entries. If an ajax request is being triggered, and this ajax request is being performed synchronously, this method also returns an array of Xplain.Db.State entries. If the ajax request is being performed asynchronously, the
success
function will receive an array of Xplain.Db.State entries as input parameter.- Parameters
(optional) (function settings.error=f(data){throw new Xplain.Db.Exception}) – A set of key/value pairs that configure the getStates request. All settings are optional. A default can be set using the
Xplain.Db.Configuration.setDefaults()
method.(optional) – defines if the request sent to the backend should be asynchronous or synchronous.
(optional) – defines if the request should support CORS (note: the backend also has to enable CORS requests).
(optional) – The URL used for this request.
(optional) – number of milliseconds until a timeout will be triggered.
(optional) – function what will be triggered if the Xplain Data backend reports an HTTP Status Code 200. The first parameter passed to this function will be an array of
Xplain.Db.State
instances.(optional) – function what will be triggered if the Xplain Data backend reports anything but a HTTP Status Code 200. The first parameter passed to this function will be an instance of the data returned by the backend.
- Returns
{array} array of
Xplain.Db.State
instances.
getStatesForLevel
- getStatesForLevel(level[, settings])
Returns an array of all states on a specific level of this attribute. Returns an array of Xplain.Db.State entries. If the ajax request is being performed asynchronously, the
success
function will receive an array of Xplain.Db.State entries as input parameter.- Parameters
level (integer) – The number of the level for which you would like to fetch the states. 0 = top level.
(optional) (function settings.error=f(data){throw new Xplain.Db.Exception}) – A set of key/value pairs that configure the getStates request. All settings are optional. A default can be set using the
Xplain.Db.Configuration.setDefaults()
method.(optional) – defines if the request sent to the backend should be asynchronous or synchronous.
(optional) – defines if the request should support CORS (note: the backend also has to enable CORS requests).
(optional) – The URL used for this request.
(optional) – number of milliseconds until a timeout will be triggered.
(optional) – function what will be triggered if the Xplain Data backend reports an HTTP Status Code 200. The first parameter passed to this function will be an array of
Xplain.Db.State
instances.(optional) – function what will be triggered if the Xplain Data backend reports anything but a HTTP Status Code 200. The first parameter passed to this function will be an instance of the data returned by the backend.
- Returns
{array} array of
Xplain.Db.State
instances.
getStatesHierarchy
- getStatesHierarchy([settings])
Returns the whole hierarchy of all states assigned to this attribute. Returns an array of all direct descending Xplain.Db.State instances of this attribute. Each of these states may have a set of children states. If not yet fetched, this triggers an ajax request to fetch the states hierarchy. If already fetched once, this simply returns an array of Xplain.Db.State entries. If an ajax request is being triggered, and this ajax request is being performed synchronously, this method also returns an array of Xplain.Db.State entries. If the ajax request is being performed asynchronously, the
success
function will receive an array of Xplain.Db.State entries as input parameter.- Parameters
(optional) (function settings.error=f(data){throw new Xplain.Db.Exception}) – A set of key/value pairs that configure the getStates request. All settings are optional. A default can be set using the
Xplain.Db.Configuration.setDefaults()
method.(optional) – defines if the request sent to the backend should be asynchronous or synchronous.
(optional) – defines if the request should support CORS (note: the backend also has to enable CORS requests).
(optional) – The URL used for this request.
(optional) – number of milliseconds until a timeout will be triggered.
(optional) – function what will be triggered if the Xplain Data backend reports an HTTP Status Code 200. The first parameter passed to this function will be an array of
Xplain.Db.State
instances.(optional) – function what will be triggered if the Xplain Data backend reports anything but a HTTP Status Code 200. The first parameter passed to this function will be an instance of the data returned by the backend.
- Returns
{array} an array of
Xplain.Db.State
instances.
getVerboseId
- getVerboseId()
Returns the ID of this attribute in the format the backend uses natively.
- Returns
{object} the ID of this attribute
open
- open()
Returns an instance of
Xplain.Db.Query
which may be execute or opened in order to fetch data for this attribute. This is a handy shortcut method, which simply returns the most basic query used for instance by Window instance of the Xplain.Ux package to visualize this attributes data.If this attribute has the ID
O.D.A
, this function would return a query with a group byO.D.A
and anCOUNT
aggregation ofO
.- Returns
{Xplain.Db.Query} the query constructed to fetch data for this attribute.
remove
- remove([settings])
Removes this attribute for the rest of this session from the current configuration. When you reload the current configuration, i.e. when you start a new session with this configuration, this attribute will still be assigned to the corresponding dimension.
- Parameters
(optional) (function settings.error=f(data){throw new Xplain.Db.Exception}) – A set of key/value pairs that configure the
remove
request. All settings are optional. A default can be set using theXplain.Db.Configuration.setDefaults()
method.(optional) – defines if the request sent to the backend should be asynchronous or synchronous.
(optional) – defines if the request should support CORS (note: the backend also has to enable CORS requests).
(optional) – The URL used for this request.
(optional) – number of milliseconds until a timeout will be triggered.
(optional) – function what will be triggered if the Xplain Data backend reports an HTTP Status Code 200. The first parameter passed to this function will be an instance of
Xplain.Db.QueryData
(optional) – function what will be triggered if the Xplain Data backend reports anything but a HTTP Status Code 200. The first parameter passed to this function will be an instance of the data returned by the backend.
- Returns
{null|Xplain.Db.QueryData} if async=false, this method will return an instance of
Xplain.Db.QueryData
. If async=true, use the first parameter passed to the success function.
select
- select(states[, settings])
Sets and executes a selection on this attribute. This selection will be a global-selection and will therefore influence the result of each query executed later on.
- Parameters
states (array) – An array of strings representing the name of states on which the selection will be set. Instead of an array of strings you may also pass an array of
Xplain.Db.State
instances.(optional) (function settings.error=f(data){throw new Xplain.Db.Exception}) – A set of key/value pairs that configure the select request. All settings are optional. A default can be set using the
Xplain.Db.Configuration.setDefaults()
method.(optional) – The name of the selection set, this selection should belong to. Defaults to
globalSelections
.(optional) – Defines if the request sent to the backend should be asynchronous or synchronous.
(optional) – Defines if the request should support CORS (note: the backend also has to enable CORS requests).
(optional) – The URL used for this request.
(optional) – number of milliseconds until a timeout will be triggered.
(optional) – Function what will be triggered if the Xplain Data backend reports an HTTP Status Code 200. The first parameter passed to this function will be the resulting data.
(optional) – Function what will be triggered if the Xplain Data backend reports anything but a HTTP Status Code 200. The first parameter passed to this function will be an instance of the data returned by the backend.