Table of Contents

Class Int

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

Represents the INT (integer) mathematical function that truncates a number to its integer part.

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

Remarks

The INT function removes the fractional part of a number, returning only the integer portion. Unlike FLOOR, INT always rounds toward zero: INT(4.7) returns 4, INT(-4.7) returns -4. This is useful for removing decimal places without rounding, extracting whole number parts, or type conversion operations.

Examples

Truncate float sensor readings to their integer part:

var schema = manager.LoadSchema("telemetry");
var readings = schema["readings"];

var query = new Query()
    .Select([ readings["sensor_id"], new Expression("int_value", new Int(readings["raw_value"])) ])
    .From(readings);

var results = manager.Retrieve(query);

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

var schema = manager.LoadSchema("telemetry");
var readings = schema["readings"];
Column rawColumn = readings["raw_value"];

var query = new Query()
    .Select([ readings["sensor_id"], new Expression("int_value", new Int(rawColumn)) ])
    .From(readings);

var results = manager.Retrieve(query);

Truncate a hard-coded double literal to its integer part:

var query = new Query()
    .Select([ new Expression("truncated", new Int(4.75)) ]);

var results = manager.Retrieve(query);

Constructors

Int(IEnumerable<IElement>)

Initializes a new instance of INT for multiple elements.

Int(double)

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

Int(IElement)

Initializes a new instance of INT for a single element.

Int(Column)

Initializes a new instance of INT for a column.