Numbers

The number inputs let the user provide a number.

Decimal

Decimal input lets the end user type only decimal numbers.

decimal

The return type is not guaranteed to be of type BigDecimal. Therefore, always cast to BigDecimal when you read the input value:

Forms
Groovy
def formFieldSet = api.createConfiguratorEntry()

formFieldSet.inputs = [
    api.inputBuilderFactory()
        .createUserEntry('decimal')
        .buildContextParameter()
]

return formFieldSet
In input generation mode (input generation mode)
Groovy
api.inputBuilderFactory()
        .createUserEntry('decimal')
        .getInput()
In header Logics
Groovy
processor.addOrUpdateInput(                 //❶
        'ROOT',
        api.inputBuilderFactory()
                .createUserEntry('decimal')
                .buildMap()
)

❶ the processor can be one of the quoteProcessor, cProcessor, etc., which references subclasses of the CalculableLineItemCollectionBuilder

Reading input value

Reading input value in a line-item logic

Groovy
def value = input.decimal as BigDecimal

Integer

Integer input lets the end user type only integers.

integer
Forms
Groovy
def formFieldSet = api.createConfiguratorEntry()

formFieldSet.inputs = [
    api.inputBuilderFactory()
        .createIntegerUserEntry('integer')
        .buildContextParameter()
]

return formFieldSet
In input generation mode (input generation mode)
Groovy
api.inputBuilderFactory()
        .createIntegerUserEntry('integer', )
        .getInput()
In header Logics
Groovy
processor.addOrUpdateInput(                 //❶
        'ROOT',
        api.inputBuilderFactory()
                .createIntegerUserEntry('integer')
                .buildMap()
)

❶ the processor can be one of the quoteProcessor, cProcessor, etc., which references subclasses of the CalculableLineItemCollectionBuilder

Reading input value

Reading input value in a line-item logic

Groovy
def value = input.integer as Integer

Minimum and Maximum Values

You can restrict the set of values that the end user can provide to the input by using the setFrom() and setTo() methods.

Groovy
api.inputBuilderFactory()
        .createIntegerUserEntry('NaturalNumber')
        .setFrom(1)
        .setTo(100)
        .getInput()