How can I set format for column in matrix input?
Question
How can I set the format (e.g., money or numeric) for a column in a matrix input?
Answer
def ce = api.createConfiguratorEntry(InputType.INPUTMATRIX, "Quantity Breaks")
def columns = ["Quantity", "UOM", "No. of Picks", "Price", "Price Unit Amount", "Price Unit UOM", "Cost", "Total Cost", "Discount (%)", "Margin (%)", "Margin", "Line Value", "CalcWay" , "MarginMapping", "userCost"]
def types = ["Numeric", "Text", "Numeric", "Numeric", "Numeric", "Text", "Numeric", "Numeric", "Numeric", "Numeric", "Numeric", "Numeric", "Text", "Text", "Text"]
def hiddenColumns = ["Total Cost", "CalcWay", "MarginMapping", "userCost"]
//translations
def labels = []
def userLanguage = api.input("userLanguage") ?: "en"
lib.Translation.initializeTranslation(userLanguage)
columns.each {
labels << lib.Translation.translate(it, "Matrix")
}
ce.getFirstInput().setLabel("")
ce.getFirstInput().addParameterConfigEntry("columns", columns)
ce.getFirstInput().addParameterConfigEntry("columnLabels", labels)
ce.getFirstInput().getParameterConfig()?.put("readonlyColumns", ["Margin", "Line Value", "Total Cost"])
ce.getFirstInput().getParameterConfig()?.put("hiddenColumns", hiddenColumns)
ce.getFirstInput().getParameterConfig()?.put("columnType", types)
The only supported column types are "Text", "Numeric", and "Money".
For multiTierEntry
, the only things you can set are "sorting" and validation.
def tiers = api.multiTierEntry("Desc Validation", "%", "%", "DESC", "VALIDATE")
def tiers2 = api.multiTierEntry("default", "Units", "\$")
def val = api.multiTierEntry("ASC NO_VALIDATION", "Price Condition", "Quantity", "ASC", "NO_VALIDATION")
return tiers
, multiple selections available,
Related content
Result Matrix
Result Matrix
More like this
Result Matrix
Result Matrix
More like this
How to Add 'Total row' to Result Matrix
How to Add 'Total row' to Result Matrix
More like this
How to Create and Populate ResultMatrix Object
How to Create and Populate ResultMatrix Object
More like this
Formatting Functions
Formatting Functions
More like this
How to Set the Number of Displayed Decimals in User Input
How to Set the Number of Displayed Decimals in User Input
More like this
Found an issue in documentation? Write to us.