Input Functions
Name and Link to API Docs | Code Example | Screenshot |
---|---|---|
anyUser | Use this method to select a user. Returns the user's login name (not the full user object). | |
booleanUserEntry | ||
configurator | ||
createConfiguratorEntry | def ce = api.createConfiguratorEntry() def radio = ce.createParameter(InputType.RADIO, "Fuel") ce.getFirstInput()?.setValueOptions(["Gasoline","Ethanol","Methanol"]) return ce Available input types are: PRODUCT, PRODUCTGROUP, CUSTOMER, CUSTOMERGROUP, USERENTRY, STRINGUSERENTRY, OPTION, INTEGERUSERENTRY, BOOLEANUSERENTRY, DATEUSERENTRY, TIMEUSERENTRY, DATETIMEUSERENTRY, MULTITIERENTRY, INPUTMATRIX, OPTIONS, RADIO, BUTTON, BOOLEAN, MATRIXLOOKUP, LOOKUP, FILTERBUILDER, DMFILTERBUILDER, DMSOURCE, DMFIELD, DMFIELDS, DMDIMFILTER, REBATEAGREEMENT, CONFIGURATOR, HIDDEN, INLINECONFIGURATOR, TEXTUSERENTRY, USER. | |
createConfiguratorEntryArray | ||
customerGroupEntry | api.customerGroupEntry() | |
datamartFilterBuilderUserEntry | def dmCtx = api.getDatamartContext() def dimFilters =["CustomerID", "ProductID"] def filter = api.datamartFilterBuilderUserEntry("Italy", "Transaction DM", dimFilters, Filter.equal("Country", "Italy")) api.trace("Filter", null, filter) def dm = dmCtx.getDatamart("Transaction DM") def q = dmCtx.newQuery(dm) q.select("Country") q.select("CustomerID") q.select("ProductID") q.select("SUM(InvoicePrice)", "Revenue") q.select("SUM(Quantity)", "Volume") q.where(filter) api.trace("Query", null, q) def result = dmCtx.executeQuery(q) api.trace("Data", null, result?.data) return result | |
dateTimeUserEntry | api.dateTimeUserEntry("Enter Date and Time") | |
dateRangeUserEntry | api.dateRangeUserEntry("Enter Date Range") This input renders only in the Unity UI. | |
dateUserEntry | api.dateUserEntry("Shipping Date") | |
decimalUserEntry | api.decimalUserEntry('decimalUserEntry') | |
dimFilterEntry | def ctx = api.getDatamartContext() def dm = ctx.getDatamart("Sales_Data") def period = dm.getColumn("Country") return ctx.dimFilterEntry("Customer Country", period) | |
filterBuilderUserEntry | api.filterBuilderUserEntry("Build a Product Filter", "P") | |
getParameter | ||
input | ||
inputBuilder | Allows you to configure inputs in an easier and more robust way. The method returns an InputBuilder class allowing you to create a specific input. When using this method, you no longer have to remember names of all the different parameters (String constants). There is a Builder for each input type. All Builders extend one class because there are many properties common to all the inputs. The Builder provides a means to build the input in several ways:
| |
inputMatrix | The following code snippet creates an input matrix: api.inputMatrix("InputMatrix","col1","col2","col3", "col4", "col5") def cp = api.getParameter("InputMatrix") //Prefills col1 with values cp.setValue([["col1":"A", "col5":"Hello"],["col1":"B"]]) //Makes col1 non-editable cp.addParameterConfigEntry("readOnlyColumns",["col1"]) //Prevents showing the add/delete row buttons cp.addParameterConfigEntry("canModifyRows",false) //Prevents showing columns in the matrix (supported only in the Unity UI) cp.addParameterConfigEntry("hiddenColumns",["col1", "col2"]) //Predefines a drop-down list with values cp.addParameterConfigEntry("columnValueOptions",["col2" : ["Tokyo","Singapore","Bangkok"]]) //Sets the column data type cp.addParameterConfigEntry("columnType",[null, null, "Money", "Numeric", null]) //The only supported column types are "Text", "Numeric", and "Money". //Disables row selection (hides the check-box) cp.addParameterConfigEntry("disableRowSelection",true) //Adds the quick filter to the Input Matrix cp.addParameterConfigEntry("enableClientFilter",true) //Sets column labels cp.addParameterConfigEntry('columnLabels',['Customer', 'Margin Δ (pts)']) | |
integerUserEntry | ||
multiTierEntry | It renders a list of input tuples – Target & Value. Example api.multiTierEntry("Surcharge", "each", "€") Syntax Object multiTierEntry(String entryName, String... valueHints) Parameters:
Returns
This code will multiply the values (the 2nd column) with the given number def tieredVal = api.multiTierEntry("Growth Target", "%","%") tieredVal = tieredVal.multiplyValues(0.01) Conversion of the returned value (List of TieredValue) to Map api.multiTierEntry("Growth Target", "%","%")?.asMap() TieredValue functions:
| |
option | ||
options | ||
otherCustomer | ||
otherProduct | Use this method to select a single product. | |
parsableInputFile | This method creates an input parameter which lets the user pick an XLSX file to be used in a logic. It returns a handle that uniquely identifies the binary and its version that has been assigned to the input. The This methods works only for entities with attachments (i.e. Quotes, Agreements/Promotions, Rebate Agreements). As the upload file is stored in the database and linked there to e.g., a quote, you need to save the quote first to have an instance in the database. def excelHandle = api.parsableInputFile("Excel Input") if (excelHandle) { // if a file is uploaded api.logInfo("data", api.parsableInputFileData("Excel Input")) // do something with this } else { api.logInfo("data", "No file uploaded") } | |
productGroupEntry | ||
rebateAgreementUserEntry | ||
stringUserEntry | ||
targetDate | ||
textUserEntry | ||
timeUserEntry | ||
userEntry |
You can reference the inputs using input.<parameter name>
. Example:
api.userEntry("Total Discount") def TotDisc = input."Total Discount"
Found an issue in documentation? Write to us.