Table of Contents

Class Floor

Namespace
YndigoBlue.Velocity.Functions
Assembly
YndigoBlue.Velocity.dll

Represents the FLOOR mathematical function that rounds a number down to the nearest integer.

public class Floor : Function, ICheckItem, IDefaultItem, IFilterItem, IElement
Inheritance
Floor
Implements

Remarks

The FLOOR function returns the largest integer less than or equal to the input value. For example, FLOOR(4.7) returns 4, FLOOR(-4.3) returns -5. This is useful for truncating decimals, bucketing values, or ensuring maximum quantities when rounding down is required.

Examples

Round each price down to the nearest whole dollar:

var schema = manager.LoadSchema("catalog");
var products = schema["products"];

var query = new Query()
    .Select([ products["name"], new Expression("floor_price", new Floor(products["price"])) ])
    .From(products);

var results = manager.Retrieve(query);

Use the typed Column constructor when working with a pre-resolved column variable:

var schema = manager.LoadSchema("catalog");
var products = schema["products"];
Column priceColumn = products["price"];

var query = new Query()
    .Select([ products["name"], new Expression("floor_price", new Floor(priceColumn)) ])
    .From(products);

var results = manager.Retrieve(query);

Round a hard-coded numeric literal down to the previous integer:

// Double literal: FLOOR(4.7) → 4
var floorDouble = new Floor(4.7);

// Decimal literal: FLOOR(4.9m) → 4
var floorDecimal = new Floor(4.9m);

Constructors

Floor(IEnumerable<IElement>)

Initializes a new instance of FLOOR for multiple elements.

Floor(decimal)

Initializes a new instance of FLOOR for a decimal literal value.

Floor(double)

Initializes a new instance of FLOOR for a double literal value.

Floor(IElement)

Initializes a new instance of FLOOR for a single element.

Floor(Column)

Initializes a new instance of FLOOR for a column.