GetElement (PQL)

Returns a member from list based on its position in the list.

  • Returned Output: Member
  • Library: PQL \ Semantic \ Member
  • Version: 2018.00.000
  • Compatibility: Pyramid Query Language (PQL) data sources

Syntax

GetElement( <List> , <Integer> )

* Click on the function's arguments above for more details on the input values.

Comments
  • List parameter should be a list or set of elements from an existing hierarchy in the model.
  • The position is a positive integer, indicating the list position of the member that should be returned, The positions are zero based, meaning the first element is position "0".
  • For details on how to employ and use this function see the semantic calculation overview.
Different Function types

Examples

This example returns the member California in the state hierarchy (assuming we're only using US states), because California is the 5th state in the US hierarchy:

GetElement( AllMembers([Customer].[state]) 4 )

The following example returns the last member in the customer email hierarchy. Notice that to derive the position, we count the elements in the hierarchy list and then deduct "1" - because the positions are zero based. So if there are 125 elements in the list, the last item is #124. Using the LastElement function would achieve the same result.

GetElement( AllMembers([Customer].[Emails]) Count(AllMembers([Customer].[Emails]))-1 )