***************************************************** ***************************************************** ***************************************************** ***************************************************** ***************************************************** ********************** WARNING ********************** ********************** WARNING ********************** ********************** WARNING ********************** ********************** WARNING ********************** ********************** WARNING ********************** ********************** WARNING ********************** ********************** WARNING ********************** ********************** WARNING ********************** ********************** WARNING ********************** ********************** WARNING ********************** This Confluence article was automatically generated from Asciidoc. Any changes you make to this document will be overridden! If you want to change the content, consider leaving a comment. You can edit the content directly here: https://gitlab.pricefx.eu/training/pricefx-knowledge-base/-/tree/dev/public/content/docs/quick-reference/user-inputs/number ***************************************************** ***************************************************** ***************************************************** ***************************************************** ***************************************************** ********************** WARNING ********************** ********************** WARNING ********************** ********************** WARNING ********************** ********************** WARNING ********************** ********************** WARNING ********************** ********************** WARNING ********************** ********************** WARNING ********************** ********************** WARNING ********************** ********************** WARNING ********************** ********************** WARNING **********************

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:

def formFieldSet = api.createConfiguratorEntry()

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

return formFieldSet
api.inputBuilderFactory()
        .createUserEntry('decimal')
        .getInput()
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 in a line-item logic.
def value = input.decimal as BigDecimal

Integer

Integer input lets the end user type only integers.

integer
def formFieldSet = api.createConfiguratorEntry()

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

return formFieldSet
api.inputBuilderFactory()
        .createIntegerUserEntry('integer', )
        .getInput()
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 in a line-item logic.

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 setMin() and setMax() methods.

api.inputBuilderFactory()
        .createIntegerUserEntry('NaturalNumber')
        .setMin(0)
        .getInput()

As of version 7.3, the input validation has not been implemented in the frontend application. However, you can still set these properties in the Groovy logic.