Home > @i2analyze/i2connect > condition
condition() function
The @condition
decorator, which configures a service method parameter to receive a value that a user provides, subject to a condition that you specify.
Signature:
export declare function condition(condition: services.ICondition): ParameterDecorator;
Introduced: API version 1.0
Parameters
Parameter | Type | Description |
---|---|---|
condition | services.ICondition | Settings that determine what users see, and what constitutes a valid value. |
Returns:
ParameterDecorator
Example
The @condition
decorator in the following service method declaration results in users seeing an input field that guarantees the value of the octet
parameter to be in the configured range.
async findIPAddresses(
@condition({
label: "IP address octet number",
description: "A mandatory integer between 0 and 255",
logicalType: LogicalType.INTEGER,
minValue: 0,
maxValue: 255,
mandatory: true
}) octet: number,
...)