Class InputBuilderFactory

Object
InputBuilderFactory

public class InputBuilderFactory extends Object
Input Builder Factory class as a convenient way to create inputs (user entries, context parameters).

See the Input Builders Knowledge Base article.

Example

def nameInput = api.inputBuilderFactory()
         .createTextUserEntry("Name")
         .buildContextParameter()
 
See Also:
  • Constructor Details

  • Method Details

    • createUserEntry

      public SimpleInputBuilder<BigDecimal> createUserEntry(String paramName)
      Creates new UserEntry BigDecimal user input (context parameter).
      Example:
      
           if (api.isInputGenerationExecution()) {
           api.inputBuilderFactory()
               .createUserEntry("SalesDiscountPct")
               .setLabel("Sales Discount (%)")
               .setFormatType("PERCENT")
               .getInput()
      
       } else {
           input.SalesDiscountPct
       }
       
      The input field is rendered as follows:

      Parameters:
      paramName - Name of the user input parameter. For the names use the "camel case" (no spaces and capital letters). This value is not meant as a label of the input field, but rather a name which should stay stable for a long time. Remember, the input fields are stored e.g. on every single Quote line item and are created only once when adding the new line. If you need to modify the label (or other properties) of the input parameter, you can use getParameter(String).
      Returns:
      User entry input builder.
      See Also:
    • createIntegerUserEntry

      public SimpleInputBuilder<Integer> createIntegerUserEntry(String paramName)
      Creates new IntegerUserEntry Integer user input (context parameter).
      Example:
      
       if (api.isInputGenerationExecution()) {
           return api.inputBuilderFactory()
                   .createIntegerUserEntry("Integer")
                   .setLabel("Enter a whole number")
                   .setPlaceholderText("23")
                   .getInput()
       } else {
           input.Integer
       }
       
      The input field is rendered as follows:

      Parameters:
      paramName - Name of the user input parameter. Use "camel case" for the names (no spaces and capital letters). This value is not meant as a label of the input field, but rather a name which should stay stable for a long time. Remember, the input fields are stored e.g. on every single Quote line item and are created only once, when adding the new line. If you need to modify the label (or other properties) of the input parameter, you can use getParameter(String).
      Returns:
      Integer user entry builder.
      See Also:
    • createBooleanUserEntry

      public SimpleInputBuilder<Boolean> createBooleanUserEntry(String paramName)
      Creates new BooleanUserEntry Boolean input (context parameter). Rendered as a checkbox.
      Example:
      
           if (api.isInputGenerationExecution()) {
           return api.inputBuilderFactory()
                   .createBooleanUserEntry("Boolean")
                   .setLabel("Boolean")
                   .getInput()
       } else {
           input.Boolean
       }
       
      The input field is rendered as follows:

      Parameters:
      paramName - Name of the user entry parameter.
      Returns:
      Boolean user entry builder.
      See Also:
    • createDateUserEntry

      public SimpleInputBuilder<String> createDateUserEntry(String paramName)
      Creates new DateUserEntry Date input (context parameter). Rendered as a date picker field that enables the user to enter a date value.
      Example:
      
       if (api.isInputGenerationExecution()) {
           return api.inputBuilderFactory()
                   .createDateUserEntry("Date")
                   .setLabel("Select date")
                   .getInput()
       } else {
           api.parseDate("yyyy-MM-dd", input.Date)
       }
       
      The input field is rendered as follows:

      Parameters:
      paramName - Name of the user entry parameter.
      Returns:
      Date user entry builder.
      See Also:
    • createDateRangeUserEntry

      public DateRangeInputBuilder createDateRangeUserEntry(String paramName)
      Creates new DateRangeUserEntry input (context parameter). Creates an input parameter rendered as two date picker fields that let the user enter a date range (start and end date).

      Note: This is available in Unity UI only.

      
           if (api.isInputGenerationExecution()) {
           return api.inputBuilderFactory()
                   .createDateRangeUserEntry("DateRange")
                   .setLabel("Select start date and end date")
                   .getInput()
       } else {
           api.parseDate("yyyy-MM-dd", input.DateRange)
       }
       
      The input field is rendered as follows:

      Parameters:
      paramName - Name of the user entry parameter.
      Returns:
      Date range user entry builder.
      See Also:
    • createTimeUserEntry

      public SimpleInputBuilder<String> createTimeUserEntry(String paramName)
      Creates new TimeUserEntry user input (context parameter). Rendered as a time picker field that enables the user to enter a time value in the format "HH:mm" (e.g. "23:59").
      Example:
      
       if (api.isInputGenerationExecution()) {
           return api.inputBuilderFactory()
                   .createTimeUserEntry("Time")
                   .setLabel("Time")
                   .getInput()
       } else {
           input.Time
       }
       
      The input field is rendered as follows (as an example – with the time selection menu expanded):

      Parameters:
      paramName - Name of the user entry parameter.
      Returns:
      Time user entry builder.
      See Also:
    • createDateTimeUserEntry

      public SimpleInputBuilder<String> createDateTimeUserEntry(String paramName)
      Creates new DateTimeUserEntry input (context parameter). Rendered as a datetime picker field that enables the user to enter a date time value in the format "dd/MM/yyyy HH:mm" (e.g. "23/01/2019 10:30").

      Note: The format implicitly uses the GMT/UTC time zone and so the returned value may differ from what was entered on the client side (as the client time may be in a different time zone).
      Example:

      
           if (api.isInputGenerationExecution()) {
           api.inputBuilderFactory()
                   .createDateTimeUserEntry("DateTime")
                   .setLabel("Select date and time")
                   .getInput()
       } else {
           api.parseDate("yyyy-MM-dd'T'HH:mm:ss", input.DateTime)
       }
       
      The input field is rendered as follows:

      Parameters:
      paramName - Name of the user entry parameter.
      Returns:
      DateTime user entry builder.
      See Also:
    • createRadioEntry

      public OptionInputBuilder createRadioEntry(String paramName)
      Creates a new radio input (context parameter). A user can select one value from many by clicking the radio button.

      Example (with the "No" option selected as default):

      
       def radio = api.inputBuilderFactory()
               .createRadioEntry('radioEntry')
               .setOptions(['Yes', 'No'])
               .setValue('No')
               .setLabel('Yes or no?')
      
               .buildMap()
       
      The input field is rendered as follows:

      Parameters:
      paramName - Name of the parameter.
      Returns:
      Radio user entry builder.
      See Also:
    • createSliderEntry

      public SliderInputBuilder createSliderEntry(String paramName)
      Creates new slider input (context parameter). User can select one BigDecimal value from a slider widget.

      Example:

      
       def slider = api.inputBuilderFactory().createSliderEntry("MySlider")
           .setFrom(0)
           .setTo(10)
           .setValue(5)
           .setSubLabels('left', 'right')
           .buildContextParameter();
       
      The slider entry is rendered as follows:

      Parameters:
      paramName - Name of the parameter.
      Returns:
      Slider user entry builder.
      See Also:
    • createHiddenEntry

      public SimpleInputBuilder<Object> createHiddenEntry(String paramName)
      Creates new hidden input (context parameter). This type of input is not visible to the user.

      Example:

      
       if (api.isInputGenerationExecution()) {
           return api.inputBuilderFactory()
                   .createHiddenEntry("hidden")
                   .setLabel("Hidden")
                   .getInput()
       }
      
       return input.hidden
       
      Parameters:
      paramName - Name of the parameter.
      Returns:
      Hidden entry builder.
      See Also:
    • createButtonEntry

      public ButtonInputBuilder createButtonEntry(String paramName)
      Creates a new button input. Available for Configurator only.

      Example:

      
       def ce = api.createConfiguratorEntry()
       def button = api.inputBuilderFactory()
               .createButtonEntry("button")
               .setLabel("Button")
               .setTargetPage(AppPages.MD_PRODUCTS_PAGE)
               .buildContextParameter()
      
       return ce.createParameter(builder)
      
       
       
      The button is rendered as follows:

      Parameters:
      paramName - Name of the parameter (a button input).
      Returns:
      Button entry builder.
      See Also:
    • createStringUserEntry

      public StringInputBuilder<String> createStringUserEntry(String paramName)
      Creates new StringUserEntry user input (context parameter).
      Example:
      
       if (api.isInputGenerationExecution()) {
           return api.inputBuilderFactory()
                   .createStringUserEntry("String")
                   .setLabel("String")
                   .setValue("Replace me")
                   .getInput()
       } else {
           input.String
       }
       
      The input field is rendered as follows:

      Parameters:
      paramName - Name of the user entry parameter.
      Returns:
      String user entry builder.
      See Also:
    • createTextUserEntry

      public SimpleInputBuilder<String> createTextUserEntry(String paramName)
      Creates new TextUserEntry InputType.TEXTUSERENTRY user input (context parameter). Rendered as a multi-line text box that enables the user to enter a longer text value.
      Example:
      
       if (api.isInputGenerationExecution()) {
           return api.inputBuilderFactory()
                   .createTextUserEntry("Comments")
                   .setLabel("Comment")
                   .getInput()
       } else {
           input.Comments
       }
       
      The input field is rendered as follows:

      Parameters:
      paramName - Name of the user entry parameter.
      Returns:
      Text user entry builder.
      See Also:
    • createAnyUserEntry

      public SimpleInputBuilder<String> createAnyUserEntry(String paramName)
      Creates new UserEntry InputType.USERENTRY input (context parameter). It is rendered as a user picker dialog / select list.
      Example:
      
           if (api.isInputGenerationExecution()) {
           return api.inputBuilderFactory()
                   .createAnyUserEntry("AnyUser")
                   .setLabel("AnyUser")
                   .getInput()
       } else {
           input.AnyUser
       }
       
      The input field is rendered as follows:

      Parameters:
      paramName - Name of the entry parameter.
      Returns:
      User entry input builder.
      See Also:
    • createVLookup

      public VLookupBuilder createVLookup(String paramName)
      Creates new LookUp InputType.LOOKUP input (context parameter). Searches for a record in the price parameter table named parameterName where the column 'name' matches the value entered by the user (in a drop-down input parameter) and returns the value from the column 'value'.

      Side effect: During the Input Generation mode this function creates a new input parameter (drop-down) whose values are taken from the column "Name" of the given Company Parameter.

      Example:

      
       if (api.isInputGenerationExecution()) {
           return api.inputBuilderFactory()
                   .createVLookup("VolumeDiscount")
                   .setLabel("Select a discount")
                   .getInput()
       }
       
      The input field is rendered as follows:

      Parameters:
      paramName - Name of the price parameter table to look up.
      Returns:
      User entry input builder.
      See Also:
    • createProductEntry

      public ProductInputBuilder createProductEntry()
      Creates new ProductEntry InputType.PRODUCT input (context parameter). This is an empty product entry object that must be filled with input parameters by calling createParameter on the object.
      Returns:
      Product entry builder.
      See Also:
    • createProductEntry

      public ProductInputBuilder createProductEntry(String paramName)
      Creates new ProductEntry InputType.PRODUCT user input (context parameter). This is commonly used in PromotionManager and RebateManager. It is rendered as a product group picker widget.
      Example:
      
       if (api.isInputGenerationExecution()) {
           return api.inputBuilderFactory()
                   .createProductEntry("Product")
                   .setLabel("Select a product")
                   .getInput()
       } else {
           input.Product
       }
       
      The input field is rendered as follows:

      Parameters:
      paramName - Name of the user input parameter.
      Returns:
      Product input builder.
      See Also:
    • createProductGroupEntry

      public PCGroupInputBuilder createProductGroupEntry()
      Creates new ProductGroupEntry InputType.PRODUCTGROUP input (context parameter). This is an empty product group entry object. Must be filled with input parameters by calling createParameter on the object.
      Returns:
      Product group entry builder.
      See Also:
    • createProductGroupEntry

      public PCGroupInputBuilder createProductGroupEntry(String paramName)
      Creates new ProductGroupEntry InputType.PRODUCTGROUP user input (context parameter). Creates an input parameter that enables the user to select a group of products. This is commonly used in PromotionManager and RebateManager. It is rendered as a product group picker widget.
      Example:
      
       if (api.isInputGenerationExecution()) {
           return api.inputBuilderFactory()
                   .createProductGroupEntry("ProductGroup")
                   .setLabel("Select products")
                   .getInput()
       } else {
           ProductGroup.fromMap(input.ProductGroup)
       }
       
      The input field is rendered as follows (as an example – multiple products selected):

      Parameters:
      paramName - Name of the user entry parameter.
      Returns:
      Product group entry builder. The input parameter returns the user selection as a Map:
      
       [
         "productFieldName"  : "attribute3",
         "productFieldLabel" : "Business Unit",
         "productFieldValue" : "MeatBall"
       ]
       
      See Also:
    • createCustomerEntry

      public CustomerInputBuilder createCustomerEntry()
      Creates new CustomerEntry InputType.CUSTOMER input (context parameter). This is an empty customer entry object. Must be filled with input parameters by calling createParameter on the object.
      Returns:
      Customer entry builder.
      See Also:
    • createCustomerEntry

      public CustomerInputBuilder createCustomerEntry(String paramName)
      Creates new CustomerEntry InputType.CUSTOMER input (context parameter). This is commonly used in Agreement & Promotions and Rebates. It is rendered as a customer picker widget.
      Example:
      
           if (api.isInputGenerationExecution()) {
           return api.inputBuilderFactory()
                   .createCustomerEntry("customer")
                   .setLabel("Select a customer")
                   .getInput()
       } else {
           input.Customer
       }
       
      The customer picker is rendered as follows:

      Parameters:
      paramName - Name of the user entry parameter.
      Returns:
      Customer input builder.
      See Also:
    • createCustomerGroupEntry

      public PCGroupInputBuilder createCustomerGroupEntry()
      Creates new CustomerGroupEntry InputType.CUSTOMERGROUP input (context parameter). This is an empty customer group entry object. Must be filled with input parameters by calling createParameter on the object.
      Returns:
      Customer group entry builder.
      See Also:
    • createCustomerGroupEntry

      public PCGroupInputBuilder createCustomerGroupEntry(String paramName)
      Creates new CustomerGroupEntry InputType.CUSTOMERGROUP input (context parameter). This input parameter enables the user to select multiple customers and return the selection as a Map. This is commonly used in Agreement & Promotions and Rebates. It is rendered as a customer group picker widget.
      Example:
      
           if (api.isInputGenerationExecution()) {
           return api.inputBuilderFactory()
                   .createCustomerGroupEntry("CustomerGroup")
                   .setLabel("Customer(s)")
                   .getInput()
       } else {
           CustomerGroup.fromMap(input.CustomerGroup)
       }
       
      The customer picker is rendered as follows:

      Parameters:
      paramName - Name of the user entry parameter.
      Returns:
      Customer group input builder.
      
       [
         "customerFieldName" : "attribute3",
         "customerFieldLabel" : "Customer Type",
         "customerFieldValue" : "Restaurant"
       ]
       
      See Also:
    • createSellerEntry

      public SellerInputBuilder createSellerEntry()
      Creates new SellerEntry InputType.SELLER input (context parameter). This is an empty seller entry object. Must be filled with input parameters by calling createParameter on the object.
      Returns:
      Seller entry builder.
      See Also:
    • createSellerEntry

      public SellerInputBuilder createSellerEntry(String paramName)
      Creates new SellerEntry InputType.SELLER user input (context parameter). It is rendered as a seller picker widget.
      Example:
      
       if (api.isInputGenerationExecution()) {
           return api.inputBuilderFactory()
                   .createSellerEntry("Seller")
                   .setLabel("Select a seller")
                   .getInput()
       } else {
           input.Seller
       }
       
      The input field is rendered as follows:

      Parameters:
      paramName - Name of the user entry parameter.
      Returns:
      Seller entry builder.
      See Also:
    • createSellerGroupEntry

      public PCGroupInputBuilder createSellerGroupEntry()
      Creates new SellerGroupEntry InputType.SELLERGROUP input (context parameter). This is an empty seller group entry object. Must be filled with input parameters by calling createParameter on the object.
      Returns:
      Seller group entry builder.
      See Also:
    • createSellerGroupEntry

      public PCGroupInputBuilder createSellerGroupEntry(String paramName)
      Creates new SellerGroupEntry InputType.SELLERGROUP input (context parameter). This input parameter enables the user to select a group of sellers and returns the selection as a Map. It is rendered as a seller group picker widget.

      Example:

      
      
       if (api.isInputGenerationExecution()) {
           return api.inputBuilderFactory()
                   .createSellerGroupEntry("SellerGroup")
                   .setLabel("Seller(s)")
                   .getInput()
       } else {
           SellerGroup.fromMap(input.SellerGroup)
       }
       
      The input field is rendered as follows:

      Parameters:
      paramName - Name of the user entry parameter.
      Returns:
      Seller group input builder.
      
       [
         "sellerFieldName" : "attribute3",
         "sellerFieldLabel" : "Seller Type",
         "sellerFieldValue" : "Restaurant"
       ]
       
      See Also:
    • createOptionEntry

      public OptionInputBuilder createOptionEntry(String paramName)
      Creates new OptionEntry InputType.OPTION user input (context parameter). The input returns a value selected by the user from a list displayed in drop-down input parameter.

      Side effect: During the Input Generation mode, this function triggers creation of a drop-down input parameter with the given list of options.

      Example:

      
       if (api.isInputGenerationExecution()) {
           def salesOrgs = [
                   "yellow": "top",
                   "blue": "bottom"
           ]
      
           return api.inputBuilderFactory()
                   .createOptionEntry("Option")
                   .setOptions(salesOrgs.keySet() as List)
                   .setLabels(salesOrgs)
                   .setLabel("Option")
                   .getInput()
       } else {
           input.Option
       }
           
      The input field is rendered as follows (with the drop-down menu expanded):

      Note: This input is also supported as a context linking button in a ResultMatrix cell since 9.0 Hurricane.

      Parameters:
      paramName - Name of the user entry parameter.
      Returns:
      Option input builder.
      See Also:
    • createOptionsEntry

      public OptionInputBuilder createOptionsEntry(String paramName)
      Creates new OptionsEntry InputType.OPTIONS input (context parameter). The input parameter enables the user to select multiple values from predefined options. It is rendered as a drop-down list of possible options. Each selected value appears at the top.

      Example:

      
       if (api.isInputGenerationExecution()) {
           def salesOrgs = [
                   "yellow": "top",
                   "blue": "bottom"
           ]
      
           return api.inputBuilderFactory()
                   .createOptionsEntry("Options")
                   .setOptions(salesOrgs.keySet() as List)
                   .setLabels(salesOrgs)
                   .setLabel("Options")
                   .getInput()
       } else {
           input.Options
       }
           
      The input field is rendered as follows (with multiple options selected):

      By default, the options are sorted alphabetically by label. If your labels contain numbers which need to be sorted correctly, you can add blank spaces to influence the sorting. For example:

      
              label: '  ABC'
              label: '10k'
              Label: ' 5k'
              label: ' 2.5k'
           
      will result in this order in the UI: ABC, 2.5k, 5k, 10k.
      Parameters:
      paramName - Name of the user entry parameter.
      Returns:
      Option input builder.
      See Also:
    • createInputMatrix

      public InputMatrixInputBuilder createInputMatrix(String paramName)
      Creates new InputMatrix InputType.INPUTMATRIX user input (context parameter). This input parameter enables the user to select a matrix of values. It renders as a grid-style input widget with the specified columns. The result will be a list (= rows) of maps (= row's columns). The map attribute names are the column names.

      Make sure the column names are valid JSON identifiers (spaces are ok but try to avoid special chars).
      Example:

      
           if (api.isInputGenerationExecution()) {
           def columns = ["Col 1", "Col 2"]
           def columnsValueOption = [
                   "Col 1": ["Yellow", "Blue"]
           ]
      
           return api.inputBuilderFactory()
                   .createInputMatrix("InputMatrix")
                   .setColumns(columns)
                   .setColumnValueOptions(columnsValueOption)
                   .setLabel("InputMatrix")
                   .getInput()
       } else {
           input.InputMatrix
       }
       
      The input matrix is rendered as follows:

      Parameters:
      paramName - Name of the input parameter.
      Returns:
      Input matrix input builder.
      See Also:
    • createFilterBuilder

      public FilterBuilderInputBuilder createFilterBuilder(String paramName, String typeCode)
      Creates new FilterBuilderUserEntry InputType.FILTERBUILDER input (context parameter). This input parameter enables the user to build a filter for a table of objects of the type defined by the typeCode parameter.

      It is rendered as a filter builder widget allowing to construct a filter (e.g. to define filter for Products, set the typeCode to P).

      The filter object can be used in other functions, like PublicGroovyAPI.find(String, Filter...), PublicGroovyAPI.stream(String, String, Filter...), PublicGroovyAPI.count(String, Filter...) etc.
      Example:

      
           if (api.isInputGenerationExecution()) {
           return api.inputBuilderFactory()
                   .createFilterBuilder("FilterBuilder", "P")
                   .setLabel("Set a product filter")
                   .getInput()
       } else {
           input.FilterBuilder
       }
       
      The filter input is rendered as follows:

      Parameters:
      paramName - Name of the user entry parameter.
      typeCode - Type code string of the type of the object for which the filter is set. Currently, the supported type codes are "P" (Product data) and "C" (Customer data).
      Returns:
      Filter input builder.
      See Also:
    • createConfiguratorInputBuilder

      public ConfiguratorInputBuilder createConfiguratorInputBuilder(String paramName, String formulaName, boolean isInline)
      Creates a new ConfiguratorEntry (a form that must be filled with inputs – defined in the other logic). It is rendered as an "Open" button in case of isInline is set to false. If isInline is set to true then form inputs are displayed directly.
      Example:
      
           if (api.isInputGenerationExecution()) {
           return api.inputBuilderFactory()
                   .createConfiguratorInputBuilder("form", "ConfiguratorLogic", false)
                   .setLabel("Configurator")
                   .getInput()
       } else {
           input.form
       }
       
      The configurator input is rendered as follows (when isInline is set to false):

      Parameters:
      paramName - A name of the input.
      formulaName - The Configurator logic name (a generic calculation logic). This logic is used to define inputs that are added to the Configurator.
      isInline - Set to true to create an inline configurator.
      Returns:
      ConfiguratorInputBuilder to set additional options
      See Also:
    • createDmFilterBuilder

      public DmFilterBuilder createDmFilterBuilder(String paramName, String source)
      Creates a new InputType.DMFILTERBUILDER input type.
      NOTE:
      If filters passed to DmFilterBuilder.setFilters(Object...) are not correct, the InputBuilderExceptions.IllegalFilterException is thrown.
      If source name passed to DmFilterBuilder.setDmSourceName(String) is not correct, the InputBuilderExceptions.NullOrEmptyArgumentException is thrown.
      Example:
      
       // The filters can be provided as Filter, ex:
       import com.googlecode.genericdao.search.Filter
       def dimFilters = Filter.equal('CustomerId', 'CD-00155')
      
       // as List, ex:
       def dimFilters = ['CustomerId', 'ProductId']
      
       // as Map, ax:
       def dimFilters = [CustomerId : 'CD-00155', ProductId : 'MB-0005']
      
       // or advanced filter as Map, ex:
       def dimFilters = [_constructor: 'AdvancedCriteria',
                         criteria    : [[fieldName: 'CustomerId', value: 'CD-00155', operator: 'equals'],
                                        [fieldName: 'ProductId', value: ['MB-0005', 'MB-0006'], operator: 'inSet']],
                         operator    : 'and']
      
       if (api.isInputGenerationExecution()) {
         return api.inputBuilderFactory()
             .createDmFilterBuilder('dataFilter', "datamartTransaction")
             .setFilters(dimFilters)
             .getInput()
       }
      
       return input.dataFilter
       

      Parameters:
      paramName - Name of the user entry parameter, if null or empty InputBuilderExceptions.NullOrEmptyArgumentException is thrown
      source - Name of the source for which the filter is set, if null or empty InputBuilderExceptions.NullOrEmptyArgumentException is thrown.
      If source is not found, the InputBuilderExceptions.NotFoundDataManagerException is thrown.
      The resolution of the source is as follows:
      1. any Datamart - by typedId, sourceName, uniqueName or label
      2. any FieldCollection - by typedId or sourceName
      Returns:
      Datamart filter builder.
      See Also:
    • createDmFilterBuilderMultiple

      public DmFilterBuilderMultiple createDmFilterBuilderMultiple(String paramName, String source)
      Creates a new datamartFilterBuilderUserEntries InputType.DMFILTERBUILDERMULTIPLE input (context parameter). This input parameter allows the user to build a filter for a given Datamart using multiple filter values.

      The filter can be used in DatamartContext.Query.where(Filter...) of the PublicGroovyAPI.datamartQuery(Object...).

      It will render a multi-option FilterBuilder widget entry allowing to construct a filter object filtering on the specified Data Source.

      Example:

      Please note: The method returns a map, therefore the filterFromMap method must be used to convert the map object into the filter object (see the example below).
      Also, check the input value for null as the api.filterFromMap method does not accept the null value as an argument.

      
       if (api.isInputGenerationExecution()) {
         return api.inputBuilderFactory()
             .createDmFilterBuilderMultiple("DataFilter", "datamart_transaction")
             .setLabel("Data Filter")
             .setRequired(false)
             .setNoRefresh(true)
             .getInput()
       }
      
       return input.DataFilter ? api.filterFromMap(input.DataFilter) : null
       

      Example 2:

      
       def filter1 = datamartFilterBuilderUserEntries("ProductGroup", "Transactions_DM")
      
       def dimFilterList = ["CustomerId", "ProductId"]
       def filter2 = datamartFilterBuilderUserEntries("ProductGroup", "Transactions_DM", dimFilterList)
      
       def dimFilterMap = ["CustomerId" : "CD-00155", "ProductId" : "MB-0005"]
       def filter3 = datamartFilterBuilderUserEntries("ProductGroup", "Transactions_DM", dimFilterMap, Filter.equal("Country", "DE"))
       
      The input field is rendered as follows:

      Parameters:
      paramName - Name of the user entry parameter.
      source - Name of the source for which the filter is set. The resolution of the source is as follows:
      1. any Datamart - by typedId, sourceName, uniqueName or label (uniqueName and label for backwards compatibility)
      2. any FieldCollection - by typedId or sourceName
      Returns:
      Datamart filter builder.
      See Also:
    • createDmFilter

      public DmFilter createDmFilter(String paramName, String fcTypedId, String field)
      Creates new DM dim filter input InputType.DMDIMFILTER.

      Example:

      
       def dm = api.inputBuilderFactory()
               .createDmFilter("Select a product", "DM.datamart_transaction", "ProductID")
               .buildMap()
      
       quoteProcessor.addOrUpdateInput(dm)
       
      The input field is rendered as follows:

      Parameters:
      paramName - Name of the user entry parameter.
      fcTypedId - Name of the source for which the filter is set. The resolution of the source is as follows:
      1. any Datamart - by typedId, sourceName, uniqueName or label (uniqueName and label for backwards compatibility)
      2. any FieldCollection - by typedId or sourceName
      field - field name
      Returns:
      DmFilter
    • createDmQueryBuilder

      public DmQueryBuilderInputBuilder createDmQueryBuilder(String paramName)
      Advanced input allowing to build one or more queries on PA and PO data sources (DMDS, DM, DMT,...).

      Example:

      
           def param = api.inputBuilderFactory()
                      .createDmQueryBuilder("query")
                      .setLabel("Build your query")
                      .getInput()
       
      The query builder is rendered as follows:

      See DatamartContext.newQueriesFromQueryBuilder(Map) and DatamartContext.newJoinFromQueryBuilder(Map) for full-featured examples.

      Parameters:
      paramName - Name of the input.
      Returns:
      DmQueryBuilderInputBuilder
      Since:
      11.0 Paper Plane
    • createDmQueryFilterBuilder

      public DmQueryFilterBuilderInputBuilder createDmQueryFilterBuilder(String paramName, Map<String,Object> dmQueryBuilderState)
      Advanced input to use jointly with DM Query Builder. It allows to select one of the series configured in the Query Builder, and to define a Filter to apply to its results.

      Its value is a singleton Map, with the selected series alias as key, and the Filter as mapped value.

      Example:

      
           def param = api.inputBuilderFactory()
                      .createDmQueryBuilder("query")
                      .setLabel("Build your query")
                      .getInput()
           def param = api.inputBuilderFactory()
                      .createDmQueryFilterBuilder("filter", qbState)
                      .setLabel("Build your filter")
                      .getInput()
       

      See DatamartContext.newJoinFromQueryFilterBuilder(Map, Map) for a full-featured example.

      The filter input field is rendered as follows:

      Parameters:
      paramName - Name of the input.
      dmQueryBuilderState - Value returned by a DM Query Builder input
      Returns:
      DmQueryFilterBuilderInputBuilder
      Since:
      11.0 Paper Plane
    • createMultiTierEntryInputBuilder

      public MultiTierInputBuilder createMultiTierEntryInputBuilder(String paramName)
      Creates a new MultiTierInputBuilder.
      Example:
      
       import net.pricefx.common.api.chart.TieredValueValidationType
       import net.pricefx.common.api.chart.TieredValueSortType
      
       if (api.isInputGenerationExecution()) {
           api.inputBuilderFactory()
                   .createMultiTierEntryInputBuilder("multiTier")
                   .setLabel("Multi Tier")
                   .setValue([
                            "10" : "20",
                            "20" : "40"
                       ])
                   .setSortType(TieredValueSortType.ASC)
                   .setValidationType(TieredValueValidationType.NO_VALIDATION)
                   .getInput()
       } else {
           input.multiTier
       }
       
      The multi tier inputs are rendered as follows:

      Parameters:
      paramName - Name of the parameter.
      Returns:
      MultiTierInputBuilder
    • createDMField

      public DMFieldInputBuilder createDMField(String paramName, String source)
      Creates a new DMField InputType.DMFIELD input field (a context parameter). This input parameter enables a user to select a DMFieldCollection field from the drop-down menu (only one option can be selected). The Datamart is specified by the source parameter.

      Example:

      
       def builder = api.inputBuilderFactory().createDMField("MyInput","DM.datamart_transaction")
                         .setLabel("DM Field")
                         .setFieldTypes(FieldType.NUMBER, FieldType.MONEY) // to select either number or money fields
                         .setFieldKind(FieldKind.DIMENSION, FieldKind.KEY) // AND that are dimension or key
       return libs.InputLib.Input.inputParamBuilder(out, builder)
       
      The input field is rendered as follows (as an example - with a value already selected):

      Parameters:
      paramName - A name of the input field
      source - A name of the source Datamart to choose a field from
      Returns:
      DMField input builder
      Since:
      7.3 Bijou
      See Also:
    • createDMFields

      public DMFieldInputBuilder createDMFields(String paramName, String source)
      Creates a new DMField InputType.DMFIELDS input field (a context parameter). This input parameter enables a user to select a DMFieldCollection field from the drop-down menu (multiple options can be selected). The Datamart is specified by the source parameter.

      Example:

      
       def builder = api.inputBuilderFactory().createDMFields("MyInput","DM.datamart_transaction")
                         .setFieldTypes(FieldType.NUMBER, FieldType.MONEY) // to select either number or money fields
                         .setFieldKind(FieldKind.DIMENSION, FieldKind.KEY) // AND that are dimension or key
       return libs.InputLib.Input.inputParamBuilder(out, builder)
       
      The input field is rendered as follows (as an example - with values selected):

      Parameters:
      paramName - A name of the input field
      source - A name of the source Datamart to choose fields from
      Returns:
      DMFields input builder
      Since:
      7.3 Bijou
      See Also:
    • createParsableInputTypeFile

      public SimpleInputBuilder<Object> createParsableInputTypeFile(String paramName)
      Creates a new ParsableInputFile InputType.PARSABLEINPUTFILE input (a context parameter).

      This input parameter enables a user to upload an XLSX file.
      This method works only with entities that can have attachments (e.g., Quotes, Agreements/Promotions, Rebate Agreements). Since the uploaded file is stored and linked in the database, you must first save the entity (e.g., a quote) to create an instance in the database.

      Example:

      
       def builder = api.inputBuilderFactory().createParsableInputTypeFile("File")
       return libs.InputLib.Input.inputParamBuilder(out,builder)
       
      The input field is rendered as follows:

      Parameters:
      paramName - A name of the input field
      Returns:
      A handle that uniquely identifies the binary and its version assigned to the input.
      Since:
      7.3 Bijou
      See Also:
    • createRebateAgreement

      public SimpleInputBuilder<Object> createRebateAgreement(String paramName)
      Creates a new RebateAgreement InputType.REBATEAGREEMENT user input (a context parameter). This input parameter enables a user to choose/pick a rebate agreement from the drop-down menu.

      Example:

      
       if (api.isInputGenerationExecution()) {
           return api.inputBuilderFactory()
                   .createRebateAgreement("RebateAgreement")
                   .setLabel("Select a Rebate Agreement")
                   .getInput()
       } else {
           input.RebateAgreement
       }
       
      The input field is rendered as follows:

      Parameters:
      paramName - A name of the input field
      Returns:
      RebateAgreement input builder
      Since:
      7.3 Bijou
      See Also:
    • createQuoteType

      public SimpleInputBuilder<Object> createQuoteType(String paramName)
      Creates a new QuoteType InputType.QUOTETYPE input (a context parameter). This input parameter enables a user to choose/pick a quote type from the drop-down menu and picker.

      Example:

      
       def builder = api.inputBuilderFactory().createQuoteType("New quote")
       return libs.InputLib.Input.inputParamBuilder(out,builder)
       
      The input fields are rendered as follows (within the ResultMatrix):

      Note: This input is currently only supported as a context linking button in a ResultMatrix cell.

      Parameters:
      paramName - A name of the input field
      Returns:
      QuoteType input builder
      Since:
      9.0 Hurricane
      See Also:
    • createDMSource

      public DMSourceInputBuilder createDMSource(String paramName)
      Creates a new DMSource InputType.DMSOURCE input (a context parameter). This input parameter enables a user to choose an existing FieldCollection from the drop-down menu.

      Example:

      
       def builder = api.inputBuilderFactory()
               .createDMSource("DMSource")
               .setLabel("Select the Field Collection Source")
               .setTypes("DMDS", "DM")
       return libs.InputLib.Input.inputParamBuilder(out, builder)
       
      The input field is rendered as follows:

      Parameters:
      paramName - A name of the input field
      Returns:
      DMSource input builder
      Since:
      7.3 Bijou
      See Also:
    • createRowLayout

      public RowInputBuilder<Object> createRowLayout(String name)
      Displays inputs in a row – inputs will appear next to one another in the user interface.
      The default behavior (without employing createRowLayout(String)) is to display inputs under each other.

      Info: Mandatory 'Expiry Date' and 'Effective Date' fields are displayed in a row by default from version 10.0.

      Example – Creates two input fields and places them side by side in a row:

      
       def ce = api.createConfiguratorEntry()
      
       def input1 = api.inputBuilderFactory()
                     .createRebateAgreement("ra")
                     .setLabel('Select a Rebate Agreement')
                     .buildContextParameter()
      
       def input2 = api.inputBuilderFactory()
                     .createProductEntry("product")
                     .setLabel('Select a Product')
                     .buildContextParameter()
      
       def inputRow = api.inputBuilderFactory()
                       .createRowLayout("row")
                       .addInput(input1)
                       .addInput(input2)
                       .addToConfiguratorEntry(ce)
      
       return ce
           
      The input fields are rendered in a row as follows:

      Parameters:
      name -
      Returns:
      Row input builder
      Since:
      7.4 Bijou
      See Also:
    • createCollapseLayout

      public CollapseInputBuilder<Object> createCollapseLayout(String name)
      Displays inputs in a collapsible section allowing users to expand or collapse this section.
      The grouped items can be regular inputs, or InputType.ROW elements or even another (nested) InputType.COLLAPSE elements.

      Example – creates two userEntry inputs and adds them in a collapsible section:

      
       def ce = api.createConfiguratorEntry()
      
       def input1 = api.inputBuilderFactory()
                     .createUserEntry("Input1")
                     .setValue("23")
                     .setLabel("Input1")
                     .buildContextParameter()
      
       def input2 = api.inputBuilderFactory()
                     .createUserEntry("Input2")
                     .setValue("24")
                     .setLabel("Input2")
                     .buildContextParameter()
      
       def inputRow = api.inputBuilderFactory()
                       .createCollapseLayout("Collapsible Section")
                       .setCollapsed(false)
                       .addInput(input1)
                       .addInput(input2)
                       .addToConfiguratorEntry(ce)
      
       return ce
           
      The inputs in the section are rendered as follows:

      Parameters:
      name -
      Returns:
      Collapse input builder
      Since:
      7.4 Bijou
      See Also:
    • createDashboardPopup

      public DashboardPopupInputBuilder createDashboardPopup(String paramName)
      Creates a new InputType.DASHBOARDPOPUP input which allows the user to select a Dashboard and define some associated preferences, including its input filters and displayed portlets. The front end will display the selected Dashboard in a fully editable popup window.
      It's possible to define a Filter in order to show only a subset of the available Dashboards.

      Example to show only Dashboards starting with "<prefix>":

      
           def input = api.inputBuilderFactory()
                            .createDashboardPopup("Dashboard")
                            .setFilter(Filter.ilike("uniqueName", "<prefix>%"))
                            .getInput()
       
      The input is rendered as follows (before a dashboard is selected):

      Parameters:
      paramName - Name of the input.
      Returns:
      a Dashboard Popup input builder
      Since:
      11.0 Paper Plane
    • createDashboardInputs

      public DashboardInputsInputBuilder createDashboardInputs(String paramName, String dashboardName, String... portletPath)
      Creates a new Dashboard Inputs input which displays all inputs of a given dashboard. All inputs will be displayed inline, similar to how PublicGroovyAPI.inlineConfigurator(java.lang.String, java.lang.String) is rendered.

      The value of the Dashboard Inputs input is a Map of all the dashboard's inputs. Key is an individual input's name, mapped to its value.

      
           def optionalPath = ["embeddedPortlet", "embeddedPortletInsideEmbeddedPortlet"]
           def input = api.inputBuilderFactory()
                          .createDashboardInputs("DB Inputs", "Dashboard_UniqueName", *optionalPath)
                          .setMaximumDepth(1) // optional - maximum recursion levels for embedded Dashboards
                          .getInput()
       
      The input is rendered as follows (embedded fields from the given Dashboard):

      Parameters:
      paramName - Name of the input.
      dashboardName - Name of a dashboard.
      Returns:
      a Dashboard Inputs input builder
      Since:
      11.1 Paper Plane
    • createConfiguratorTable

      public ConfiguratorTableInputBuilder createConfiguratorTable(String paramName)
      Creates a table (InputType.CONFIGURATORTABLE) where a user can add rows using the modal dialog (the pop-up Configurator). Fields of this modal dialog are specified by Configurator inputs.
      There can be multiple types (rowType) of row within the table – different Configurator inputs. If there are more types available, the user can select one of the type by clicking the Add drop-down button.
      ConfiguratorTable is supported in all input contexts - Header, Line Item (generic), and Configurator.

      Example – creates a new configuratorTable:

      
       def columns = [
           [name: 'Date', label: 'Date', type: 'DATE'],
           [name: 'Datetime', label: 'Datetime', type: 'DATETIME'],
           [name: 'Integer', label: 'Integer', type: 'INTEGER'],
           [name: 'Link', label: 'Link', type: 'LINK'],
           [name: 'Money', label: 'Money', type: 'MONEY'],
           [name: 'MoneyEUR', label: 'Money EUR', type: 'MONEY_EUR'],
           [name: 'Numeric', label: 'Numeric', type: 'NUMERIC'],
           [name: 'NumericLong', label: 'Numeric Long', type: 'NUMERIC_LONG'],
           [name: 'Percent', label: 'Percent', type: 'PERCENT'],
           [name: 'String', label: 'String', type: 'TEXT'],
           [name: 'Product', label: 'Product', type: 'TEXT'],
           [name: 'Customer', label: 'Customer', type: 'TEXT'],
       ]
      
       def rowTypes = [
           [label: "Add Product Row", url: "configuratorTableTest_ProductConfigurator"],
           [label: "Add Customer Row", url: "configuratorTableTest_CustomerConfigurator"],
       ]
      
       def ct = api.inputBuilderFactory()
           .createConfiguratorTable("ConfiguratorTableName")
           .setColumns(columns)
           .setDimensions("300", "800")
           .withEnableClientFilter(false)
           .withEnableEditActions(true)
           .withEnableDuplicateActions(true)
           .withEnableDeleteActions(false)
           .withRowTypes(rowTypes)
           .setDefaultHeight(500)
           .setFixTableHeight(true)
           .setLabel("Configurator Table Label")
           .buildContextParameter()
      
       def ce = api.createConfiguratorEntry()
      
       ce.createParameter(ct)
      
       return ce
            
      The table is rendered as follows:

      Parameters:
      paramName - Name of the ConfiguratorTable input.
      Returns:
      ConfiguratorTable input builder
      Since:
      11.0 - Paper Plane
      See Also:
    • createDmQueryBuilderDimOption

      public DmQueryBuilderDimOptionBuilder createDmQueryBuilderDimOption(String paramName, String seriesAlias, String dimensionAlias, Map<String,Object> queryBuilderState)
      Creates a user input of the DMDIMQUERYSTATEOPTION type that loads only the list of dimension values from the Data Scope series, without querying all the data.

      Example – creating InputType.DMDIMQUERYSTATEOPTION within the Configurator logic:

      
       def ce = api.createConfiguratorEntry()
      
       def context = api.inputBuilderFactory()
            .createDmQueryBuilderDimOption("InvoiceLineID", 'j', 's1_InvoiceLineID', out.queryBuilderState)
            .setLabel("InvoiceLineID")
            .buildContextParameter()
      
       ce.createParameter(context)
      
       return ce
       
      The input field is rendered as follows:

      Parameters:
      paramName - A name of the user input.
      seriesAlias - The alias of series.
      dimensionAlias - The alias of the dimension you want to retrieve values for. These values are displayed as options in the user input's drop-down menu.
      queryBuilderState - The queryBuilderState object (a map) that contains the series and dimensions you want to filter option values in this user input by.
      Returns:
      A new instance of DmQueryBuilderDimOptionBuilder
      Since:
      11.1 - Paper Plane
    • createResultMatrixFilterBuilder

      public ResultMatrixFilterBuilder createResultMatrixFilterBuilder(String paramName, ResultMatrix resultMatrix)
      Creates a new user input of the RESULTMATRIXFILTER type. Generates the advanced filter using the specified Result Matrix.

      Note: Specify column formats of the Result Matrix to provide the column type information for the filter.
      Supported column formats: TEXT – allows selection from the filter's drop-down menu. Values for other formats must be manually entered into the Value input field of the filter (in the UI).

      Example – creating the Result Matrix Filter using the specified Result Matrix within the Configurator logic:

      
       def ce = api.createConfiguratorEntry()
      
      
       def products = api.find("P", 0, 10, null, ["sku", "label", "currency"])
      
       def resultMatrix = api.newMatrix().withColumnFormats([
               "sku"     : FieldFormatType.TEXT,
               "label"   : FieldFormatType.TEXT,
               "currency": FieldFormatType.TEXT
       ]).withRows(products);
      
      
       def rmFilterBuilder = api.inputBuilderFactory()
               .createResultMatrixFilterBuilder("rMatrixFilter", resultMatrix)
               .setLabel("Result Matrix Filter")
               .buildContextParameter()
      
       return ce.createParameter(rmFilterBuilder)
       

      The input field is rendered as follows:

      Parameters:
      paramName - A name of the result matrix filter.
      resultMatrix - The ResultMatrix to filter on.
      Returns:
      A new instance of ResultMatrixFilterBuilder.
      Since:
      11.2 - Paper Plane
      See Also:
    • createCustomFormListPopup

      public CustomFormListPopupInputBuilder createCustomFormListPopup(String paramName, String typedId)
      Creates a new user input of the InputType.CUSTOMFORMLISTPOPUP type – the "Open" button that opens the pop-up modal. Allows a user to select a Custom Form (CFO) from the list of CFOs (opened as a pop-up modal) with the specified Custom Form Type (CFOT).
      Example:
      
       if (api.isInputGenerationExecution()) {
            return api.inputBuilderFactory()
                    .createCustomFormListPopup("customFormPopup", "123.CFOT")
                    .setLabel("Select a Custom Form")
                    .withSubsetFilter(Filter.equal("formStatus", "APPROVED"))
                    .withRecalculateParentOnPopupConfirm(true)
                    .getInput()
        } else {
            input.customFormPopup
        }
       
      Parameters:
      paramName - A name of the CustomFormListPopup input.
      typedId - The typedId of the Custom Form Type you want to display Custom Forms in the pop-up modal for.
      Returns:
      CustomFormListPopupInputBuilder
      Since:
      12.0 - Clover Club
      See Also:
    • createCustomFormPopup

      public CustomFormPopupInputBuilder createCustomFormPopup(String paramName, String typedId)
      Creates a new user input of the InputType.CUSTOMFORMPOPUP type – the "Open" button that opens the standalone CFO. Allows a user to open a Custom Form (CFO).
      Example:
      
       if (api.isInputGenerationExecution()) {
            def typedId = api.find("CFO", Filter.equal("uniqueName", "CFO-123"))[0].typedId
            return api.inputBuilderFactory()
                    .createCustomFormPopup("customFormPopup", typedId)
                    .setLabel("Open a Custom Form")
                    .withRecalculateParentOnPopupConfirm(true)
                    .getInput()
        } else {
            input.customFormPopup
        }
       
      Parameters:
      paramName - A name of the CustomFormPopup input.
      typedId - The typedId of the Custom Form you want to open.
      Returns:
      CustomFormPopupInputBuilder
      Since:
      13.0 - Rampur
      See Also:
      • CustomFormPopupInputBuilder
    • createConfigurationWizardPopup

      public ConfigurationWizardPopupInputBuilder createConfigurationWizardPopup(String paramName, String typedId)
      Creates a new user input of the InputType.CONFIGURATIONWIZARDPOPUP type – the "Open" button that opens the CW. Allows a user to open a Configuration Wizard (CW).
      Example:
      
       if (api.isInputGenerationExecution()) {
            def typedId = api.find("CW", Filter.equal("uniqueName", "CW-123"))[0].typedId
            return api.inputBuilderFactory()
                    .createConfigurationWizardPopup("configurationWizardPopup", typedId)
                    .setLabel("Open Configuration Wizard")
                    .withRecalculateParentOnPopupConfirm(true)
                    .getInput()
        } else {
            input.configurationWizardPopup
        }
       
      Parameters:
      paramName - A name of the ConfigurationWizardPopup input.
      typedId - The typedId of the Configuration Wizard you want to open.
      Returns:
      CustomFormPopupInputBuilder
      Since:
      13.0 - Rampur
      See Also:
      • CustomFormPopupInputBuilder