SortItem

open class SortItem: ObjectBase

Encapsulates an OData sort item. A sort item indicates a property (or expression) that is used in the $orderby system query option.

See also

DataQuery.sortItems, DataQuery.orderBy, DataQuery.thenBy.
  • Obsolete. Use of with unlabeled parameter.

    Declaration

    Swift

    public static func of(property: Property) -> SortItem
  • A value to be used for query result ordering.

    Declaration

    Swift

    final public var value: QueryValue!
  • Sort order, which defaults to SortOrder.ascending.

    See also

    DataQuery.orderBy.

    Declaration

    Swift

    final public var order: SortOrder = SortOrder.ascending
  • Default initializer.

    Declaration

    Swift

    override public init()
  • Declaration

    Swift

    open class func of(_ value: QueryValue) -> SortItem

    Parameters

    value

    Value for result ordering.

    Return Value

    A new sort item for the specified value.

  • Obsolete. Use value.

    Declaration

    Swift

    open var path: DataPath?
  • If this sort item directly references a property, then return the property. Otherwise return nil.

    Declaration

    Swift

    open func toProperty() -> Property?

    Return Value

    The property to be selected, or nil.

  • If this sort item references a simple property path, then return the property. Otherwise throw an exception.

    Throws

    UndefinedException if this sort item does not reference a simple property path.

    Declaration

    Swift

    open func toRequiredProperty() -> Property

    Return Value

    The property to be selected.

  • Declaration

    Swift

    override open func toString() -> String

    Return Value

    A string representation of this sort item.