public interface PublicGroovyAPI
api
. That api
variable or binding is merely an instance of
this interface to expose certain "safe" methods and functionality.Modifier and Type | Method and Description |
---|---|
void |
abortCalculation()
Aborts the current item's calculation.
|
Object |
add(String typeCode,
Map<String,Object> values)
Adds a new object to the collection of objects of the given type.
|
Object |
addOrUpdate(String typeCode,
Map<String,Object> values)
Adds or updates an object in the collection of objects of the given type.
|
void |
addWarning(String message)
Adds a warning to the formula execution warning log.
|
AttributedResult |
attributedResult(Object result)
Creates an
AttributedResult object to be returned as a result of an output element. |
String |
base64Decode(String base64String)
Decodes a base64 encoded string
|
String |
base64Encode(String string)
Does a standard Base64 encoding of a string
|
Object |
bom()
Equivalent of the standard syntax "BoM" function.
|
Object |
bom(String lookupTableName)
Equivalent of the standard syntax "BoM" function.
|
Object |
bom(String lookupTableName,
String categoryName)
Equivalent of the standard syntax "BoM" function.
|
Object |
bom(String lookupTableName,
String categoryName,
String materialName)
Equivalent of the standard syntax "BoM" function.
|
Object |
bomList()
Equivalent of the standard syntax "BoMList" function.
|
Object |
booleanUserEntry(String entryName)
Equivalent of the standard syntax "BooleanUserEntry" function.
|
Object |
boundCall(String uniqueName,
String relativeUrl,
String body,
Boolean... responseBodyAsAString)
Issues an HTTP/S call to Price fx server.
|
ResultFlexChart |
buildFlexChart(Object definition)
|
ResultFlexChart |
buildFlexChart(String baseTemplateToUse,
Object definition)
Creates a
FlexChart from the passed definition by
merging it with options defined within the
baseTemplateToUse template. |
ResultHighchart |
buildHighchart(Map<String,?> definition)
BETA
Creates a ResultHighchart from the passed definition . |
ResultHighmap |
buildHighmap(Map<String,?> definition)
BETA
Creates a ResultHighmap from the passed definition . |
Calendar |
calendar()
Gets a calendar object initialized with the current targetDate (or now if no target date is given).
|
Calendar |
calendar(Date date)
Gets a calendar object initialized with
date . |
Object |
configurator(String configuratorName,
String formulaName)
Equivalent of the standard syntax "Configurator" function.
|
Object |
configurator(String configuratorName,
String formulaName,
Object resultName)
Equivalent of the standard syntax "Configurator" function.
|
Object |
configurator(String configuratorName,
String formulaName,
Object width,
Object height)
Equivalent of the standard syntax "Configurator" function.
|
Object |
contextByLabel(String label)
Equivalent of the standard syntax "ContextByLabel" function.
|
String |
contextName()
The name of the current context.
|
Set<Object> |
contextSkuSet(int startRow)
Returns a set of skus which comprise so-called 'sku context' of
the current formula execution.
|
String |
contextType()
The type (type code string) of the current context.
|
String |
contextTypedId()
The typedId of the current context
|
int |
count(String typeCode,
Filter... filters)
Similar to the
find(java.lang.String, com.googlecode.genericdao.search.Filter...) methods, this method queries an arbitrary object type. |
ConfiguratorEntry |
createConfiguratorEntry()
Creates an empty configurator entry object.
|
ConfiguratorEntry |
createConfiguratorEntry(InputType type,
String name)
Creates a cofigurator entry object and adds the specified input parameter as the first parameter to the configurator entry.
|
ConfiguratorEntry |
createConfiguratorEntry(InputType type,
String name,
Date targetDate)
Creates a cofigurator entry object and adds the specified input parameter as the first parameter to the configurator entry.
|
ConfiguratorEntryArray |
createConfiguratorEntryArray(Object... entries)
Creates configurator entry array object which is to be returned from
formula element.
|
Filter |
createElementNameFilter(String elementName,
Object fieldValue,
String... listTypedIds)
Creates a cross-list filter expression based on meta data.
|
Object |
createNewRevision(String typedId)
Creates a revision of CalculableLineItemCollection (Quote/Rebate Agreement/Contract).
|
void |
criticalAlert(String msg)
Marks the current formula element with a critical alert and the given message.
|
Map<String,Object> |
currentContext(String sku)
In case of list processing (such as a price list or a price grid), this method allows easy access to values from the same list.
|
Map<String,Object> |
currentContext(String sku,
String key2)
In case of list processing (such as a price list or a price grid), this method allows easy access to values from the same list.
|
Object |
currentItem()
In case of a list processing operation this method gets the currently worked on record (e.g., price list item or price grid item or quote item).
|
Object |
currentItem(String attributeName)
Same as
currentItem() but returns only the specified attribute. |
Object |
currentItemByElementName(String elementName)
In case of a list processing operation, this method gets the currently worked on record's property by elementName.
|
String |
currentPartitionName()
Returns the current partition name.
|
Object |
customer(String attributeName)
Equivalent of the standard syntax "Customer" function.
|
Object |
customer(String attributeName,
boolean defaultFromParent)
Equivalent of the standard syntax "Customer" function.
|
Object |
customer(String attributeName,
String customerId)
Equivalent of the standard syntax "Customer" function.
|
Object |
customer(String attributeName,
String customerId,
boolean defaultFromParent)
Equivalent of the standard syntax "Customer" function.
|
Object |
customer(String attributeName,
String customerId,
boolean defaultFromParent,
String filterFormulaName,
Object filterFormulaParam)
Equivalent of the standard syntax' "Customer" function.
|
Object |
customerExtension(String extensionName,
Filter... filters)
Equivalent of the standard syntax "CXLookup" function.
|
Object |
customerGroupEntry(String... entryName)
Equivalent of the standard syntax "CustomerGroup" function.
|
Object |
customerGroupEntry(String entryName,
String filterFormulaName,
Object filterFormulaParam)
Equivalent of the standard syntax "CustomerGroup" function.
|
Filter |
customerToRelatedObjectsFilter(String relatedObjectTypeCode,
String customerId)
Creates a filter to be applied to a search on a related object type, limiting the result to objects of the related type that have a link to the given customer.
|
void |
customEvent(Object object)
Sends an event of type "CUSTOM".
|
void |
customEvent(Object object,
String customEventType)
Sends an event of type "CUSTOM".
|
void |
customEvent(Object object,
String customEventType,
String operation)
Sends an event of type "CUSTOM".
|
void |
customEvent(Object object,
String customEventType,
String operation,
boolean omitNullValues)
Sends an event of type "CUSTOM".
|
Object |
datamartCalendar()
Deprecated.
Use
DatamartContext.calendar() instead. |
Filter |
datamartFilter(Object groupOrSlice)
Translates a CustomerGroup/ProductGroup/DMDataSlice to its equivalent Filter representation,
mapping domain level field names to the corresponding Datamart field names in the process.
|
Object |
datamartFilterBuilderUserEntry(String entryName,
String source,
Object... args)
Equivalent of the standard syntax "DatamartFilterBuilderUserEntry" function.
|
Object |
datamartLookup(Object... queryAndProjectionsAndFilters)
Important: Please use the Groovy query API instead (see
DatamartContext ). |
Object |
datamartQuery(Object... queryAndDatamartAndProjectionsAndFilters)
Important: please use the Groovy query API instead (see
DatamartContext ). |
Object |
dateTimeUserEntry(String entryName)
Equivalent of the standard syntax "DateTimeUserEntry" function.
|
Object |
dateUserEntry(String entryName)
Equivalent of the standard syntax "DateUserEntry" function.
|
Object |
decimalUserEntry(String entryName)
Alias of "userEntry", to conform to the general naming structure
|
Object |
delete(String typeCode,
Map<String,Object> values)
Deletes an object in the collection of objects of the given type.
|
boolean |
emit(Object obj)
Emits an object to be consumed by an external thread.
|
boolean |
emitPersistedObject(String typedId)
Finds the PersistedObject with the given typedId, and emits it if it exists.
|
boolean |
emitPersistedObject(String typeCode,
Long id)
Finds the PersistedObject for the given typeCode and id, and emits it if it exists.
|
void |
emitRebateRecords(String dateFieldName,
String sortBy,
Filter... filters)
Emits the rebate records matching the given search criteria, to be consumed by a PA allocation task (a PA calculation task with a feeder formula calling
this method, and a regular formula accepting each emitted RebateRecord as its currentItem context, and distributing one or more RebateRecord accruals
over the set of PA rows which have contributed to those accruals in some way (by revenue, bvolume...).
|
String |
entityRef(PartitionedObject po)
Creates entityRef value (usually db id) for the given entity.
|
double |
evalExpression(String mathExpression)
Evaluates an arithmetic expression that is passed in as a string.
|
Object |
filter(String property,
Object value)
Creates a filter object that can be used in other API functions.
|
Object |
filter(String property,
Object opString,
Object value)
Creates a filter object that can be used in other API functions.
|
Object |
filterBuilderUserEntry(String entryName,
String typeCode)
Equivalent of the standard syntax "FilterBuilderUserEntry" function.
|
Filter |
filterFromMap(Map<String,Object> filterMap)
Constructs a Filter object from the map representation of that filter (from the "wire format").
|
List<Object> |
find(String typeCode,
Filter... filters)
The Swiss army knife method of the API.
|
List<Object> |
find(String typeCode,
int startRow,
Filter... filters)
The Swiss army knife method of the API.
|
List<Object> |
find(String typeCode,
int startRow,
int maxRows,
String sortBy,
Filter... filters)
The Swiss army knife method of the API.
|
List<Object> |
find(String typeCode,
int startRow,
int maxRows,
String sortBy,
List<String> fields,
boolean distinctValuesOnly,
Filter... filters)
The Swiss army knife method of the API.
|
List<Object> |
find(String typeCode,
int startRow,
int maxRows,
String sortBy,
List<String> fields,
Filter... filters)
The Swiss army knife method of the API.
|
List<Object> |
find(String typeCode,
int startRow,
int maxRows,
String sortBy,
Map<String,String> fields,
boolean distinctValuesOnly,
Filter... filters)
The Swiss army knife method of the API.
|
List<Object> |
find(String typeCode,
int startRow,
String sortBy,
Filter... filters)
The Swiss army knife method of the API.
|
List<SummaryCalculableObjectItem> |
findApprovedPricelistItems(String sku)
Returns a list of summary items.
|
List<CalculatedFieldSet> |
findCalculatedFieldSets(Date targetDate,
String cfsName)
Returns a list of calculated field sets that match the targetDate.
|
List<CustomerAssignment> |
findCustomerAssignments(String customerId)
Finds all assignement records for the given customerId.
|
List<Customer> |
findCustomersInGroup(CustomerGroup group)
Retrieves a list of customers that match the given CustomerGroup (returns first 200 entries).
|
List<Customer> |
findCustomersInGroup(CustomerGroup group,
int startRow,
String sortBy)
Retrieves a list of customers that match the given CustomerGroup with custom paging and sorting.
|
Object |
findDataLoad(String dataLoadLabel,
String dataLoadType,
String target) |
LookupTable |
findLookupTable(String tableName)
Finds a lookup table / price parameter table based on the table name.
|
List<Object> |
findLookupTableValues(String tableName,
Filter... filters)
Searches and returns values of a named lookup table.
|
List<ManualPricelist> |
findManualPricelists(Date targetDate,
String listName)
Returns a list of manual pricelists that match the targetDate (i.e., list's validAfter <= targetDate and expiryDate > targetDate).
|
Map<String,List<String>> |
findNextRevUNs(String typeCode,
String... uniqueNames)
Finds next revision uniqueNames for given Quotes/Contracts/RebateAgreements
|
Map<String,Object> |
findPreviousApprovableState(String typedId,
String... workflowStatuses)
Finds previous approvable entity state in case some 'DENIED' or 'WITHDRAWN' workflow for the approvable exists
|
WorkflowInfo |
findPreviousWorkflowInfo(String typedId,
String... workflowStatuses)
Finds approvable entity previous workflow history in case some 'DENIED' or 'WITHDRAWN' workflow for the approvable exists
|
List<PriceGrid> |
findPriceGrids(Date targetDate,
String priceGridName)
Returns a list of price grids that match the targetDate (i.e., price grid's targetDate <= targetDate).
|
List<Pricelist> |
findPricelists(Date targetDate,
String listName)
Returns a list of pricelists that match the targetDate (i.e., list's targetDate <= targetDate and expiryDate > targetDate).
|
Object |
findRebateRecordLoad(String rebateRecordLoadLabel) |
List<Simulation> |
findSimulations(Date targetDate,
String simulationName)
Returns a list of simulations that match the targetDate (i.e., list's targetDate <= targetDate).
|
WorkflowInfo |
findWorkflowInfo(String approvableTypeCode,
Object approvableId)
Finds active workflows for the given approvable.
|
String |
formatNumber(String pattern,
Object n)
Formats a number into a string.
|
String |
formatNumber(String locale,
String pattern,
Object n)
Formats a number into a string.
|
String |
formatString(String locale,
String format,
Object... args)
Formats a string like
String.format(java.lang.String, java.lang.Object...) . |
String |
getBaseURL()
Returns the base URL component of the current instance.
|
Object |
getBinding(String name)
Gets a named binding variable from a library function.
|
Object |
getBoundPartitionNames()
Returns bound partition list.
|
<T extends CalculableLineItem> |
getCalculableLineItem(Object clic,
String lineId)
Returns a line item of the given calculable line item collection (a.k.a.
|
Object |
getCalculableLineItemCollection(String typedId)
Returns the full object (header and line items) of e.g.
|
Object |
getCalculableLineItemResult(Object cli,
String... resultNamesOrLabels)
Returns result(s) of the given name(s) (or label(s)) from a line item object (its map representation, to be exact).
|
String |
getCalculationContext()
Retreive the CalculationContext of the formula evaluation (aka formula element group).
a) For a PA Calculation or Flush formula this can be (from PriceFxInterface): - FORMULAELEMENTGROUP_DM_INIT = "init"; - FORMULAELEMENTGROUP_DM_ROW = "row"; - FORMULAELEMENTGROUP_DM_SUMMARY = "summary"; b) In RebateAgreement calculation we have: - FORMULAELEMENTGROUP_RM_AGREEMENT = "agreement"; - FORMULAELEMENTGROUP_RM_AGREEMENT_READONLY = "agreementReadOnly"; - FORMULAELEMENTGROUP_RM_REBATERECORD = "rebateRecord"; c) In the Optimizer module, when evaluating Model formulas, there is: - FORMULAELEMENTGROUP_MODEL_DEFINITION = "definition"; - FORMULAELEMENTGROUP_MODEL_CALCULATION = "calculation"; - FORMULAELEMENTGROUP_MODEL_ANALYSIS = "analysis"; |
DatamartContext |
getDatamartContext()
The DatamartContext provides an API for querying and loading PA data.
|
DatamartRowSet |
getDatamartRowSet()
Available in a PA DataLoad context only, a
DatamartRowSet provides access to the rows being loaded or calculated. |
DatamartRowSet |
getDatamartRowSet(String name)
Available in a PA DataLoad context only, a
DatamartRowSet provides access to the rows currently being loaded or calculated. |
Object |
getElement(String name)
Gets the result of a previous formula element.
|
Map<String,Object> |
getGlobal()
A publicly available cache (as a hashmap) for storing and sharing values across formula elements.
|
Long |
getId(Object obj)
Returns the id part of an object.
|
Map<String,Object> |
getItemActiveCalculationResults(String typedId)
Gets current complete active (i.e.
|
Map<String,Object> |
getItemCompleteCalculationResults(String typedId)
Gets current complete calculation results of the given item (e.g., pricelist item).
|
int |
getIterationNumber()
Returns the number of iterations this list has been calculated during this cycle.
|
String |
getLocale()
Returns the language part of the current request's locale
|
Object |
getManualOverride(String elementName)
Returns a user entered value that overrides the calculated result of a formula element.
|
int |
getMaxFindResultsLimit()
The
find(String, Filter...) method and its variations are limitied in how many results
are returned in one call. |
ContextParameter |
getParameter(String parameterName)
Retrieves an already generated (i.e.
|
ItemSummaryQuery<PriceGrid> |
getPriceGridSummaryQuery()
Creates a summary query object that can be parameterized and is then subsequently used in
runSummaryQuery(ItemSummaryQuery) . |
Map<String,Object> |
getPricelistItem(String listName)
Similar to the standard syntax "Pricelist" function.
|
ItemSummaryQuery<Pricelist> |
getPricelistSummaryQuery()
Creates a summary query object that can be parameterized and is then subsequently used in
runSummaryQuery(ItemSummaryQuery) . |
List<?> |
getProductReferences(String typeCode,
Set<String> skus)
Returns a list of product reference records that tell which other objects of given type these skus are referenced
|
Object |
getProperty(Object object,
String path)
This method serves as an optimized way to get to certain object attributes.
|
Object |
getPropertyByElementName(Object object,
String elementName)
This method gets object attributes by elementName.
|
ItemSummaryQuery<RebateRecordSet> |
getRebateRecordSummaryQuery()
Creates a summary query object that can be parameterized and is then subsequently used in
runSummaryQuery(ItemSummaryQuery) . |
Object |
getSecondaryKey()
Gets the secondary key in case a matrix pricelist or matrix simulation is processed.
|
String |
getSharedCache(String key)
Retrieves a value from the shared cache (and resets the TTL of the key).
|
ItemSummaryQuery<Simulation> |
getSimulationSummaryQuery()
Creates a summary query object that can be parameterized and is then subsequently used in
runSummaryQuery(ItemSummaryQuery) . |
TableContext |
getTableContext()
The TableContext provides an SQL query (SELECT only) interface to PA query results.
|
DateTimeZone |
getTimeZone(String tzString)
Just a wrapper for org.joda.time.DateTimeZone.forId(String tzString) method.
|
Object |
httpCall(String url,
String body)
Issues an HTTP call to external entity.
|
Object |
httpCall(String url,
String body,
String methodType,
String contentType,
Map... properties)
Issues an HTTP call to external entity.
|
Object |
inlineConfigurator(String configuratorName,
String formulaName)
Equivalent of the standard syntax' "InlineConfigurator" function.
|
Object |
input(String inputName)
Retrieves an input parameter - without triggering a user input.
|
Object |
inputMatrix(String inputMatrixName,
Map<String,Object> paramConfig,
String... columns)
Equivalent of the standard "InputMatrix" function.
|
Object |
inputMatrix(String inputMatrixName,
String... columnNames)
Equivalent of the standard "InputMatrix" function.
|
Object |
integerUserEntry(String entryName)
Equivalent of the standard syntax "IntegerUserEntry" function.
|
boolean |
isDebugMode()
Returns true if formula is called via UI debug/test exec mode.
|
boolean |
isDistributedMode()
Returns true if calculation is executed in distributed mode.
|
Boolean |
isFullListCalculation()
Indicates wether the current calculation is recalculating the entire list or only parts of it.
|
boolean |
isSecondPass()
A method to determine if the calculation is in the 2nd pass calculation.
|
boolean |
isSyntaxCheck()
Returns true if the formula is executed in syntax check (or parameter determination) mode.
|
boolean |
isUserInGroup(String userGroupName,
String loginUserName)
Checks if the current user is member of the given user group.
|
Object |
jsonDecode(String json)
A utility method to decode a JSON string into a Map representation.
|
Object |
jsonDecodeList(String json)
A utility method to decode a JSON string into a List representation.
|
Object |
jsonEncode(Object input)
A utility method to encode Object to JSON string.
|
Object |
jsonEncode(Object input,
boolean omitNull)
A utility method to encode Object to JSON string.
|
void |
markItemClean()
Removes a "dirty marker" from the current item.
|
void |
markItemClean(String sku)
Marks the specfied item clean.
|
void |
markItemClean(String sku,
String key2)
Marks the specfied item clean.
|
void |
markItemDirty()
Marks the current item dirty.
|
void |
markItemDirty(String sku)
Marks the specfied item dirty.
|
void |
markItemDirty(String sku,
String key2)
Marks the specfied item dirty.
|
MultiKey<Object> |
multiKey(Object... keys)
Constructs a new composite key object, which can be used as the key in a map.
|
Object |
multiTierEntry(String entryName,
String... arguments)
Equivalent of the standard syntax "MultiTierEntry" function.
|
AdaptiveHistogram |
newAdaptiveHistogram()
Creates a histogram that adapts to an unknown data distribution.
|
DashboardController |
newController()
Creates a new dashboard controller object that can be further customized.
|
CreationWorkflowDefinition |
newCreationWorkflow() |
CreationWorkflowStepDefinition |
newCreationWorkflowStep() |
Object |
newDatamartSlice()
Deprecated.
Now provided by
DatamartContext . |
Object |
newDatamartSlice(String dateFieldName,
Object... timePeriodsAndProductAndCustomerGroups)
Deprecated.
Now provided by
DatamartContext . |
ResultGauge |
newGauge()
Creates a new gauge object that can be further customized.
|
ResultMatrix |
newMatrix()
Creates a new result matrix DTO object that can be further customized and populated with calculated data.
|
ResultMatrix |
newMatrix(Collection<String> columns)
Creates a new result matrix DTO object that can be further customized and populated with calculated data.
|
ResultMatrix |
newMatrix(String... columns)
Creates a new result matrix DTO object that can be further customized and populated with calculated data.
|
Object |
option(String entryName,
List<Object> options,
Map<String,Object> labels)
Equivalent of the standard syntax' "Option" function.
|
Object |
option(String entryName,
Object... options)
Equivalent of the standard syntax "Option" function.
|
Object |
options(String entryName,
List<Object> options,
Map<String,Object> labels)
Equivalent of the standard syntax multi-select "Options" function.
|
Object |
options(String entryName,
Object... options)
Equivalent of the standard syntax multi-select "Options" function.
|
Object |
otherCustomer(String parameterName)
A method to trigger a custom-named customer picker input parameter.
|
Object |
otherCustomer(String parameterName,
String attributeName)
A method to trigger a custom-named customer picker input parameter.
|
Object |
otherCustomer(String parameterName,
String attributeName,
boolean defaultFromParent)
A method to trigger a custom-named customer picker input parameter.
|
Object |
otherProduct(String parameterName)
A method to trigger a custom-named product picker input parameter.
|
Object |
otherProduct(String parameterName,
String attributeName)
A method to trigger a custom-named product picker input parameter.
|
Date |
parseDate(String pattern,
String date)
Parses a date (entered in as string) according to the given pattern.
|
DateTime |
parseDateTime(String pattern,
String datetime)
Parses a datetime (entered in as string) according to the given pattern.
|
DateTime |
parseDateTime(String pattern,
String datetime,
int tzHoursOffset,
int tzMinutesOffset)
Parses a datetime (entered in as string) according to a given pattern and time zone.
|
Map<String,Object> |
previousContext(String sku)
In case of (chained) price lists, this method allows for easy retrieval of records from the previous list.
|
Map<String,Object> |
previousContext(String sku,
String key2)
In case of (chained) price lists, this method allows for easy retrieval of records from the previous list.
|
Object |
pricelist(String listName)
Equivalent of the standard syntax "Pricelist" function.
|
Object |
pricelist(String listName,
String attributeName)
Equivalent of the standard syntax "Pricelist" function.
|
Object |
pricelist(String listName,
String attributeName,
String sku)
Equivalent of the standard syntax "Pricelist" function.
|
Object |
pricelist(String listName,
String attributeName,
String sku,
String key2)
Equivalent of the standard syntax "Pricelist" function.
|
Object |
pricelistItem(String listName)
Equivalent of the standard syntax "Pricelist" function - with the difference that the full item is returned.
|
Object |
pricelistItem(String listName,
String sku)
Equivalent of the standard syntax "Pricelist" function - with the difference that the full item is returned.
|
Object |
pricelistItem(String listName,
String sku,
String key2)
Equivalent of the standard syntax "Pricelist" function - with the difference that the full item is returned.
|
Object |
product()
Returns the current product object.
|
Object |
product(String attributeName)
Equivalent of the standard syntax "Product" function.
|
Object |
product(String attributeName,
String sku)
Equivalent of the standard syntax "Product" function.
|
Object |
productCompetition()
Equivalent of the standard syntax "Competition" function.
|
Object |
productCompetition(Filter... filters)
Equivalent of the standard syntax "Competition" function.
|
Object |
productExtension(String extensionName)
Equivalent of the standard syntax "PXLookup" function.
|
Object |
productExtension(String extensionName,
Filter... filters)
Equivalent of the standard syntax "PXLookup" function.
|
Object |
productGroupEntry(String... entryName)
Equivalent of the standard syntax "ProductGroup" function.
|
Filter |
productToRelatedObjectsFilter(String relatedObjectTypeCode,
String sku)
Creates a filter to be applied to a search on a related object type, limiting the result to objects of the related type that have a link to the given product.
|
Object |
productXRef()
Equivalent of the standard syntax "XRefLookup" function.
|
Object |
productXRef(Filter... filters)
Equivalent of the standard syntax "XRefLookup" function.
|
void |
putGlobal(Map<String,Object> globalVars)
Puts an entire map of variables into the global cache.
|
Random |
random() |
Object |
rebateAgreementUserEntry(String parameterName,
String attributeName)
Prompts user for rebate agreement.
|
void |
redAlert(String msg)
Marks the current formula element with a red alert and the given message.
|
Filter |
relatedObjectToCustomersFilter(String relatedObjectTypedId)
Creates a filter to be applied to a Customer search, limiting the result to customers that are linked to the given related object, the latter defined by its typedId.
|
Filter |
relatedObjectToProductsFilter(String relatedObjerelatedObjectTypedId)
Creates a filter to be applied to a Product search, limiting the result to products that are linked to the given related object, the latter defined by its typedId.
|
void |
removeManualOverride(String elementName)
Removes a user entered value that overrides the calculated result of a formula element.
|
void |
removeSharedCache(String key)
Deletes a key from the shared chache
|
void |
resetSKUContextSwitch()
Resets a sku context switch to the origionally specified sku.
|
Map<String,String> |
roles()
Lists all roles available in the application.
|
List<Map<String,Object>> |
runSummaryQuery(ItemSummaryQuery<? extends CalculableObject> query)
Runs (executes) a summary query defined by the parameterized query object, which was created by one of the getXXXSummaryQuery calls.
|
void |
sendEmail(String to,
String subject,
String message)
Sends an email.
|
void |
setSharedCache(String key,
String value)
Stores a string value in the shared cache with the given key.
|
AbstractProducer.ResultIterator |
stream(String typeCode,
String sortBy,
Filter... filters)
Search for all types of objects with a freestyle query, and iterate over the result set.
|
AbstractProducer.ResultIterator |
stream(String typeCode,
String sortBy,
List<String> fields,
boolean distinctValuesOnly,
Filter... filters)
Search for all types of objects with a freestyle query, and iterate over the result set.
|
AbstractProducer.ResultIterator |
stream(String typeCode,
String sortBy,
List<String> fields,
Filter... filters)
Search for all types of objects with a freestyle query, and iterate over the result set.
|
AbstractProducer.ResultIterator |
stream(String typeCode,
String sortBy,
Map<String,String> fields,
boolean distinctValuesOnly,
Filter... filters)
Search for all types of objects with a freestyle query, and iterate over the result set.
|
Object |
stringUserEntry(String entryName)
Equivalent of the standard syntax "StringUserEntry" function.
|
Object |
stringUserEntry(String entryName,
String textMask)
Equivalent of the standard syntax "StringUserEntry" function.
|
Object |
stringUserEntry(String entryName,
String textMask,
String label)
Equivalent of the standard syntax "StringUserEntry" function.
|
void |
switchSKUContext(String newSKU)
Temporarily switches the current sku context to another sku.
|
Date |
targetDate()
Gets the current execution context's target date.
|
Object |
textUserEntry(String entryName)
Equivalent of the standard syntax "TextUserEntry" function.
|
Object |
textUserEntry(String entryName,
String label)
Equivalent of the standard syntax "TextUserEntry" function.
|
void |
throwException(String errorMessage)
Throws a calculation exception with the specified message and aborts the calculation.
|
Object |
timeUserEntry(String entryName)
Equivalent of the standard syntax "TimUserEntry" function.
|
void |
trace(String functionName,
String parameters,
Object result)
Generates a trace message that can be used in the formula test drive.
|
Long |
triggerCFSCalculation(Long cfsID)
This method will create a new background calculation job for the specified CFS
Note: This operation will only work in contexts that allow object modification (CFS,CalculationFlow and direct formula execution via JSON API).
|
Long |
triggerPriceGridCalculation(Long priceGridId,
Map<String,Object> parameters)
This method will create new background calculation job for the specified PriceGrid.
|
Object |
update(String typeCode,
Map<String,Object> values)
Updates an object in the collection of objects of the given type.
|
Object |
updateCalculableObjectHeader(String calcObjTypeCode,
String calcObjName)
Updates the header information of a CalculableObject (e.g., a price grid, a price list, etc.).
|
Object |
user()
Returns the entire master data object of the current user.
|
Object |
user(String attributeName)
Returns a value from the current user's master data.
|
Object |
userEntry(String entryName)
Equivalent of the standard syntax "UserEntry" function.
|
String |
uuid()
Generates a RFC4122, version 4 ID.
|
String |
uuid(int len)
Generate a random uuid of the specified length.
|
String |
uuid(int len,
int radix)
Generates a random uuid of the specified length, and radix.
|
Object |
vLookup(String parameterName)
Equivalent of the standard syntax "VLookup" function.
|
Object |
vLookup(String parameterName,
Object attributeNameOrKeyOrRangeValue)
Equivalent of the standard syntax "VLookup" function.
|
Object |
vLookup(String parameterName,
String attributeName,
String key)
Equivalent of the standard syntax "VLookup" function.
|
Object |
vLookup(String parameterName,
String attributeName,
String key1,
String key2)
Equivalent of the standard syntax "VLookup" function.
|
Object |
vLookup(String parameterName,
String attributeName,
String key1,
String key2,
String key3)
Equivalent of the standard syntax "VLookup" function.
|
Object |
vLookup(String parameterName,
String attributeName,
String key1,
String key2,
String key3,
String key4)
Equivalent of the standard syntax "VLookup" function.
|
Object |
vLookup(String parameterName,
String attributeName,
String key1,
String key2,
String key3,
String key4,
String key5)
Equivalent of the standard syntax "VLookup" function.
|
Object |
vLookup(String parameterName,
String attributeName,
String key1,
String key2,
String key3,
String key4,
String key5,
String key6)
Equivalent of the standard syntax "VLookup" function.
|
Filter |
walkFilter(Filter filter,
Closure<?> visitBefore,
Closure<?> visitAfter,
boolean removeNulls)
Walks a filter and all its sub filters, visiting each filter in the tree.
|
WrappedResult |
wrap(Object result)
Wraps a result to make sure the original result object appears in the json response.
|
void |
yellowAlert(String msg)
Marks the current formula element with a yellow alert and the given message.
|
boolean isSyntaxCheck()
boolean isDebugMode()
boolean isDistributedMode()
Map<String,Object> getGlobal()
api.retainGlobal
is set to true, this map will also be available with the entire list calculation,
i.e across item boundaries. It can be also accessed directly as api.global
.
Important: This map must be treated as a cache.
It means that the formula should never rely on the cached values, as in various situations this cache is purged
or structured differently. For example, in a distributed calculation, every calculation thread has its own cache;
or in a multi-pass list calculation, the subsequent passes may not have the cache of the previous pass available.
The system always tries to make it available, but the formula should never rely on it.void putGlobal(Map<String,Object> globalVars)
globalVars
- The map of variables to put into the global cacheString getCalculationContext()
Long getId(Object obj)
Object getElement(String name)
name
- Name of the formula elementnull
if the element is not foundObject getSecondaryKey()
Object getBinding(String name)
In a workflow formula the workflow can be referenced in a groovy element directly by the binding/variable "workflow": workflow.addApprovalStep("First Approval")
However this does not work from a library function as this script does not have the binding available. This would work: api.getBinding("workflow").addApprovalStep("First Approval")
Date targetDate()
Calendar calendar()
Calendar calendar(Date date)
date
.date
- The date to initialize the calendar withRandom random()
java.util.Random
generator instance created for the duration of the calculation task.
(i.e.) does not get recreated for each formula (element) evaluation).Object datamartCalendar()
DatamartContext.calendar()
instead.DatamartCalendar
object.@Deprecated Object newDatamartSlice()
DatamartContext
.DatamartContext.DataSlice
object.Object newDatamartSlice(String dateFieldName, Object... timePeriodsAndProductAndCustomerGroups)
DatamartContext
.dateFieldName
- Name of the time dimension field.timePeriodsAndProductAndCustomerGroups
- TimePeriod, CustomerGroup, ProductGroup filters.DatamartContext.DataSlice
object.Filter datamartFilter(Object groupOrSlice)
Note: A DMDataSlice object can be instantiated by api.newDatamartSlice, or in a Rebate calculation context, referenced by the 'calulationBase' binding.
groupOrSlice
- The CustomerGroup/ProductGroup/DMDataSlice to translate into Datamart level filter criteriaObject datamartQuery(Object... queryAndDatamartAndProjectionsAndFilters)
DatamartContext
).
This method only exists for backward compatibility for older in-production formulas.
Runs a query against a PA datamart. The query is only executed once on the scope of a calculation job (PL generation etc.).
A query is identified by the first argument. This is also the 'handle' by which datamartLookup refers to the result set of the query.queryAndDatamartAndProjectionsAndFilters
- First argument is the query ID/handle. Subsequent arguments are either DM field names (projections)
or filter objects.Object datamartLookup(Object... queryAndProjectionsAndFilters)
DatamartContext
).
This method only exists for backward compatibility for older in-production formulas.
Looks up rows in the result of a datamartQuery(...) call.queryAndProjectionsAndFilters
- The first arguments is the ID/handle from a datamartQuery(...) call. Subsequent arguments refer to
projections specified in the datamartQuery call, or filter objects leading to additional filtering of rows in the result set.DatamartContext getDatamartContext()
DatamartContext
TableContext getTableContext() throws Exception
TableContext
Exception
DatamartRowSet getDatamartRowSet()
DatamartRowSet
provides access to the rows being loaded or calculated.DatamartRowSet
holding the data rows to load in the target FC.DatamartRowSet getDatamartRowSet(String name)
DatamartRowSet
provides access to the rows currently being loaded or calculated.
The following DL types make use of rowsets:name
- Either 'source' or 'target', to select the source FC or target FC rowset.DatamartRowSet
holding either the source or target rowset.void switchSKUContext(String newSKU)
resetSKUContextSwitch()
or automatically.newSKU
- The new sku to switch to.void resetSKUContextSwitch()
Object product()
Object product(String attributeName)
attributeName
- The attribute whose value to returnObject product(String attributeName, String sku)
attributeName
- The attribute whose value to returnsku
- The productnull
if product not found)Object otherProduct(String parameterName, String attributeName)
parameterName
- The name of the parameterattributeName
- The attribute which value to return (null
for the entire object)Object otherProduct(String parameterName)
parameterName
- The name of the parameterObject productExtension(String extensionName)
extensionName
- The name of the extensionObject productExtension(String extensionName, Filter... filters)
extensionName
- The name of the extensionfilters
- One or more filter(java.lang.String, java.lang.Object)
objects that narrow down the PX searchObject productCompetition()
Object productCompetition(Filter... filters)
filter(java.lang.String, java.lang.Object)
objects that narrow down the competition searchObject productXRef()
Object rebateAgreementUserEntry(String parameterName, String attributeName)
parameterName
- - (mandatory) name of entry in input parameters listingattributeName
- - (mandatory) name of attribute you needObject productXRef(Filter... filters)
filters
- One or more filter(java.lang.String, java.lang.Object)
objects that narrow down the PXREF searchObject customer(String attributeName)
attributeName
- The attribute whose value to returnObject customer(String attributeName, boolean defaultFromParent)
null
and defaultFromParent is true
, it retrieves (and returns) the value from
the customer's parent no matter if that value is null
as well or not. In case there's no parent customer set,
null
will be returned.attributeName
- The attribute whose value to returndefaultFromParent
- Tells whether to lookup the value from the parent customer (if any) in case it's null
in the customerObject customer(String attributeName, String customerId)
attributeName
- The attribute whose value to returncustomerId
- The customerId value for the customer searchnull
if no customer found)Object customer(String attributeName, String customerId, boolean defaultFromParent)
null
and defaultFromParent is true
, it retrieves (and returns) the value from the customer's
parent no matter if that value is null
as well or not. In case there's no parent customer set, null
will be returned.attributeName
- The attribute whose value to returncustomerId
- The customerId value for the customer searchdefaultFromParent
- Tells whether to lookup the value from the parent customer (if any) in case it's null
in the customernull
if no customer found)Object customer(String attributeName, String customerId, boolean defaultFromParent, String filterFormulaName, Object filterFormulaParam)
null
and defaultFromParent is true
, retrieves (and returns) the value from the customer's
parent no matter if that value is null
as well or not. In case there's no parent customer set, null
will be returned)attributeName
- The attribute whose value to returncustomerId
- The customerId value for the customer searchdefaultFromParent
- Tells whether to lookup the value from the parent customer (if any) in case it's null
in the customerfilterFormulaName
- Unique name of a formula, that will be triggered when Customer Picker opensfilterFormulaParam
- Additional data for filterFormula (e.g. agreement's typedId,...)null
if no customer found)Object otherCustomer(String parameterName)
parameterName
- The name of the parameterObject otherCustomer(String parameterName, String attributeName)
parameterName
- The name of the parameterattributeName
- The attribute which value to return (null
for the entire object)Object otherCustomer(String parameterName, String attributeName, boolean defaultFromParent)
parameterName
- The name of the parameterattributeName
- The attribute which value to return (null
for the entire object)defaultFromParent
- Tells whether to lookup the attribute's value from the parent customer (if any) in case it's null
in the customerObject customerExtension(String extensionName, Filter... filters)
extensionName
- The name of the extensionfilters
- No, one or more filter(java.lang.String, java.lang.Object)
object/s that narrow down the CX search<T extends CalculableLineItem> T getCalculableLineItem(Object clic, String lineId)
clic
- the clic to which the line item belongs. it may either be the clic object as such (its map representation to be exact), or typedId or a uniqueNamelineId
- the lineId of the line itemObject getCalculableLineItemResult(Object cli, String... resultNamesOrLabels)
Note: The line item object will typically be fetched via getCalculableLineItem(Object, String)
.
Object getCalculableLineItemCollection(String typedId)
Object createNewRevision(String typedId)
void addWarning(String message)
message
- The warning text messageObject contextByLabel(String label)
label
- The formula element labelObject vLookup(String parameterName)
parameterName
- The name of the price parameter tableObject vLookup(String parameterName, Object attributeNameOrKeyOrRangeValue)
Example:
ownShippingCost = api.vLookup("Shipping_Costs", api.product("attribute25").toString())
parameterName
- The name of the price parameter tableattributeNameOrKeyOrRangeValue
- A predefined key, or range value (hence no user input required), or in case of a matrix lookup the attribute name => user entry requiredObject vLookup(String parameterName, String attributeName, String key)
Example:
def prevailing = api.vLookup("MixThreshold", "attribute1", "Prevailing")
parameterName
- The name of the price parameter tableattributeName
- The name of the attribute to retrievekey
- The key of the parameter tableObject vLookup(String parameterName, String attributeName, String key1, String key2)
parameterName
- The name of the price parameter tableattributeName
- The name of the attribute to retrievekey1
- The key1 of the parameter tablekey2
- The key2 of the parameter tableObject vLookup(String parameterName, String attributeName, String key1, String key2, String key3)
parameterName
- The name of the price parameter tableattributeName
- The name of the attribute to retrievekey1
- The key1 of the parameter tablekey2
- The key2 of the parameter tablekey3
- The key3 of the parameter tableObject vLookup(String parameterName, String attributeName, String key1, String key2, String key3, String key4)
parameterName
- The name of the price parameter tableattributeName
- The name of the attribute to retrievekey1
- The key1 of the parameter tablekey2
- The key2 of the parameter tablekey3
- The key3 of the parameter tablekey4
- The key4 of the parameter tableObject vLookup(String parameterName, String attributeName, String key1, String key2, String key3, String key4, String key5)
parameterName
- The name of the price parameter tableattributeName
- The name of the attribute to retrievekey1
- The key1 of the parameter tablekey2
- The key2 of the parameter tablekey3
- The key3 of the parameter tablekey4
- The key4 of the parameter tablekey5
- The key5 of the parameter tableObject vLookup(String parameterName, String attributeName, String key1, String key2, String key3, String key4, String key5, String key6)
parameterName
- The name of the price parameter tableattributeName
- The name of the attribute to retrievekey1
- The key1 of the parameter tablekey2
- The key2 of the parameter tablekey3
- The key3 of the parameter tablekey4
- The key4 of the parameter tablekey5
- The key5 of the parameter tablekey6
- The key6 of the parameter tableObject userEntry(String entryName)
entryName
- The name of the user entry parameterObject decimalUserEntry(String entryName)
entryName
- The name of the user entry parameterObject integerUserEntry(String entryName)
entryName
- The name of the user entry parameterObject stringUserEntry(String entryName)
entryName
- The name of the user entry parameterObject stringUserEntry(String entryName, String textMask)
entryName
- The name of the user entry parametertextMask
- Optional text mask that is displayed in the UIObject stringUserEntry(String entryName, String textMask, String label)
entryName
- The name of the user entry parametertextMask
- Optional text mask that is displayed in the UIlabel
- Label of the entry boxObject textUserEntry(String entryName)
entryName
- The name of the user entry parameterObject textUserEntry(String entryName, String label)
entryName
- The name of the user entry parameterlabel
- Label of the entry boxObject booleanUserEntry(String entryName)
entryName
- The name of the user entry parameterObject dateUserEntry(String entryName)
parseDate(String, String)
entryName
- The name of the user entry parameterObject timeUserEntry(String entryName)
parseDate(String, String)
entryName
- The name of the user entry parameterObject dateTimeUserEntry(String entryName)
parseDate(String, String)
entryName
- The name of the user entry parameterObject productGroupEntry(String... entryName)
entryName
- The name of the user entry parameterObject customerGroupEntry(String... entryName)
entryName
- The name of the user entry parameterObject customerGroupEntry(String entryName, String filterFormulaName, Object filterFormulaParam)
entryName
- The name of the user entry parameterfilterFormulaName
- Unique name of a formula, that will be triggered when Customer Picker opensfilterFormulaParam
- Additional data for filterFormula (e.g. agreement's typedId,...)Object multiTierEntry(String entryName, String... arguments)
entryName
- The name of the user entry parameterarguments
- Two value hints, sort type and order validation type. Sort type can be one of ASC (default), DESC,
and order validation one of VALIDATE and NO_VALIDATION.Object option(String entryName, Object... options)
entryName
- The name of the user entry parameteroptions
- An arbitrary number of parameters that make up the drop downObject option(String entryName, List<Object> options, Map<String,Object> labels)
entryName
- The name of the user entry parameteroptions
- A list of an arbitrary number of parameters that make up the drop downlabels
- A map (value => label) of labels that should be shown in the UI. If null or empty will behave same as api.option() without label definitionObject options(String entryName, Object... options)
entryName
- The name of the user entry parameteroptions
- An arbitrary number of parameters that make up the drop downObject options(String entryName, List<Object> options, Map<String,Object> labels)
entryName
- The name of the user entry parameteroptions
- A list of an arbitrary number of parameters that make up the drop downlabels
- A map (value => label) of labels that should be shown in the UI. If null or empty will behave same as api.option() without label definitionObject filterBuilderUserEntry(String entryName, String typeCode)
It will trigger a FilterBuilder widget allowing to construct a filter object filtering upon the object type represented by the passed
typeCode
(e.g. to filter upon Products, the typeCode
will be P
).
The filter object will typically be used in other API functions, like find(String, Filter...)
.
entryName
- The name of the user entry parametertypeCode
- A type code string of the type of the object to filter upon. Supported type codes are P (i.e. Product data) and C (i.e. Customer data), at the momentObject datamartFilterBuilderUserEntry(String entryName, String source, Object... args)
It will trigger a FilterBuilder widget allowing to construct a filter object filtering upon the specified source.
The filter object will typically be used in other API functions, like datamartQuery(Object...)
.
entryName
- The name of the user entry parametersource
- The name of the source to filter upon. Resolution of the source as follows
Object pricelist(String listName)
listName
- The name of the pricelist. Target date matching and sku context applies.resultPrice
of the pricelist record for the skuObject pricelist(String listName, String attributeName)
listName
- The name of the pricelist. Target date matching and sku context applies.attributeName
- The name of the attribute to retrieveattributeName
column of the pricelist recordObject pricelist(String listName, String attributeName, String sku)
listName
- The name of the pricelist. Target date matching applies.attributeName
- The name of the attribute to retrievesku
- The sku to useattributeName
column of the pricelist recordObject pricelist(String listName, String attributeName, String sku, String key2)
listName
- The name of the pricelist. Target date matching applies.attributeName
- The name of the attribute to retrievesku
- The sku to usekey2
- The key2 to use *attributeName
column of the matrix pricelist recordObject pricelistItem(String listName)
listName
- The name of the pricelist. Target date matching and sku context applies.Object pricelistItem(String listName, String sku)
listName
- The name of the pricelist. Target date matching applies.sku
- The sku to useObject pricelistItem(String listName, String sku, String key2)
listName
- The name of the pricelist. Target date matching applies.sku
- The sku to usekey2
- The key2 to useMap<String,Object> getPricelistItem(String listName)
listName
- The name of the pricelist. Target date and sku matching applies.Object bom()
Object bom(String lookupTableName)
lookupTableName
- The parameter table nameObject bom(String lookupTableName, String categoryName)
lookupTableName
- The parameter table namecategoryName
- The category name to filter onObject bom(String lookupTableName, String categoryName, String materialName)
lookupTableName
- The parameter table namecategoryName
- The categroy name to filter onmaterialName
- The material to filter onObject bomList()
Object user(String attributeName)
attributeName
- The attribute to returnObject user()
Object input(String inputName)
inputName
- The parameter nameObject inputMatrix(String inputMatrixName, String... columnNames)
inputMatrixName
- The name of the parametercolumnNames
- The column names/labelsObject inputMatrix(String inputMatrixName, Map<String,Object> paramConfig, String... columns)
inputMatrixName
- The name of the parameterparamConfig
- Map of configuration settings, with the following options (key,value):
columnNames
- The column names/labelsObject filter(String property, Object value)
Example:
def cas = api.find("CA",api.filter("assignmentId",mplId),api.filter("assignmentType","MPL"))
property
- The property's name to filter onvalue
- The specified valueFilter filterFromMap(Map<String,Object> filterMap)
filterMap
- The filter in form of nested mapsObject filter(String property, Object opString, Object value)
Note: This method is sort of dynamic. Dynamic in a sense that if the opString
does not actually represent a valid operator (e.g. "="),
the passed value will then be treated as lower bound, and the value
as upper bound. In other words, the resulting filter will look like this:
Filter.and(Filter.greaterOrEqual(property, opString), Filter.lessThan(property, value))
. If either parameter is null
, its part
is skipped.
Example:
datamartQuery.where(api.filter("PricingDate",">",targetDate.minus(365).format("yyyy-MM-dd")))
property
- The property's name to filter onopString
- One out of : "=", "<", "<=", ">", ">=", "<>", "~". If different, it gets treated as lower-bound value, then. Please see the remark.value
- The specified value (or an upper bound)Filter customerToRelatedObjectsFilter(String relatedObjectTypeCode, String customerId)
def filter = api.customerToRelatedObjectsFilter("RBA", "104083") // customerId=104083
def rbas = api.find("RBA", 0,0, null, filter)
api.trace("rbas for customer #104083", null, rbas)
relatedObjectTypeCode
- TypeCode of the related object type. Possible values are
customerId
- Customer.id to filter on.Filter relatedObjectToCustomersFilter(String relatedObjectTypedId)
def filter = api.relatedObjectToCustomersFilter("42.RBA") // rba.id=24
def customers = api.find("C", 0,0, null, filter)
api.trace("customers for rba #24", null, customers)
relatedObjectTypedId
- TypedId of the related object. Its type needs to be one of:
Filter productToRelatedObjectsFilter(String relatedObjectTypeCode, String sku)
relatedObjectTypeCode
- TypeCode of the related object type. Possible values are:
productId
- Product.id to filter on.Filter relatedObjectToProductsFilter(String relatedObjerelatedObjectTypedId)
relatedObjectTypedId
- TypedId of the related object. Its type needs to be one of:
boolean isUserInGroup(String userGroupName, String loginUserName)
userGroupName
- The group nameloginUserName
- The login name of the uservoid trace(String functionName, String parameters, Object result)
functionName
- A free to choose function nameparameters
- Parameters to traceresult
- The result of the traceContextParameter getParameter(String parameterName)
ContextParameter
object.
This can then be further modified as required.parameterName
- The named parameter to retrievenull
Map<String,Object> currentContext(String sku)
sku
- The sku to look forMap<String,Object> currentContext(String sku, String key2)
sku
- The sku to look forkey2
- The key2 to look forMap<String,Object> previousContext(String sku)
sku
- The sku to look forMap<String,Object> previousContext(String sku, String key2)
sku
- The sku to look forkey2
- The key2 to look forString contextName()
String contextType()
String contextTypedId()
Object getProperty(Object object, String path)
object
- The object whose value to retrievepath
- The attribute nameObject getPropertyByElementName(Object object, String elementName)
object
- The object whose value to retrieveelementName
- The elementName valuenull
if invalid object or no matching meta foundObject currentItem()
Object currentItemByElementName(String elementName)
Example:
def currentItem = api.currentItem() def currentSku = currentItem != null ? currentItem.attribute20 : api.product("attribute20")
elementName
- Object currentItem(String attributeName)
currentItem()
but returns only the specified attribute.attributeName
- The attribute to retrieveSet<Object> contextSkuSet(int startRow)
The form of the sku context differs, e.g., in case of product detail formula executed via price grid details, the resulting set will contain all skus of the left-pane's grid.
Note: If sku context isn't supported by the current formula
execution, null
is returned.
Note #2: A maximum of 200 skus is returned per one call. If there are more of them,
startRow
must be used to get all skus in the set.
startRow
- The starting row of the result setnull
if sku context isn't
available for the current formula executionint getMaxFindResultsLimit()
find(String, Filter...)
method and its variations are limitied in how many results
are returned in one call. Some method signatures can specify a maxResults parameter, but there is a system-defined absolute maximum.
This call returns the currently system-defined absolute maximum value.List<Object> find(String typeCode, Filter... filters)
typeCode
- A type code string of the type of the object to search for. All available type codes can be retrieved by calling <hostname>/pricefx/<partition name>/fetch
filters
- a list of filter objects that are AND'ed togetherList<Object> find(String typeCode, int startRow, Filter... filters)
typeCode
- A type code string of the type of the object to search for. All available type codes can be retrieved by calling <hostname>/pricefx/<partition name>/fetch
filters
- A list of filter(java.lang.String, java.lang.Object)
objects that are AND'ed togetherstartRow
- The starting row of the result setList<Object> find(String typeCode, int startRow, String sortBy, Filter... filters)
typeCode
- A type code string of the type of the object to search for. All available type codes can be retrieved by calling <hostname>/pricefx/<partition name>/fetch
filters
- A list of filter objects that are AND'ed togetherstartRow
- The starting row of the result setsortBy
- Sort the results by an attribute. Prefix with - for descending sort order. Can be comma separated list of sort fieldsList<Object> find(String typeCode, int startRow, int maxRows, String sortBy, Filter... filters)
Example:
def StockPX = api.find("PX", 0, "-attribute2", Filter.equal("name", "DWHStockReport"), Filter.equal("attribute1", "OFF"), Filter.equal("sku", api.product("sku")), Filter.greaterOrEqual("attribute2", date))
typeCode
- A type code string of the type of the object to search for. All available type codes can be retrieved by calling <hostname>/pricefx/<partition name>/fetch
filters
- A list of filter objects that are AND'ed togetherstartRow
- The starting row of the result setmaxRows
- The maximum number of rows to retreive. If set to 0 it will default to 200sortBy
- Sort the results by an attribute. Prefix with - for descending sort order. Can be comma separated list of sort fieldsList<Object> find(String typeCode, int startRow, int maxRows, String sortBy, List<String> fields, Filter... filters)
typeCode
- A type code string of the type of the object to search for. All available type codes can be retrieved by calling <hostname>/pricefx/<partition name>/fetch
filters
- A list of filter objects that are AND'ed togetherstartRow
- The starting row of the result setmaxRows
- The maximum number of rows to retreive. If set to 0 it will default to 200sortBy
- Sort the results by an attribute. Prefix with - for descending sort order. Can be comma separated list of sort fieldsfields
- A list of fields. If null the entire object will be returnedList<Object> find(String typeCode, int startRow, int maxRows, String sortBy, List<String> fields, boolean distinctValuesOnly, Filter... filters)
typeCode
- A type code string of the type of the object to search for. All available type codes can be retrieved by calling <hostname>/pricefx/<partition name>/fetch
filters
- A list of filter objects that are AND'ed togetherstartRow
- The starting row of the result setmaxRows
- The maximum number of rows to retreive. If set to 0 it will default to 200sortBy
- Sort the results by an attribute. Prefix with - for descending sort order. Can be comma separated list of sort fieldsfields
- A list of fields. If null the entire object will be returneddistinctValuesOnly
- fetches distinct/all values, use case is fetching distinct single column valuesList<Object> find(String typeCode, int startRow, int maxRows, String sortBy, Map<String,String> fields, boolean distinctValuesOnly, Filter... filters)
typeCode
- A type code string of the type of the object to search for. All available type codes can be retrieved by calling <hostname>/pricefx/<partition name>/fetch
filters
- A list of filter objects that are AND'ed togetherstartRow
- The starting row of the result setmaxRows
- The maximum number of rows to retreive. If set to 0 it will default to 200sortBy
- Sort the results by an attribute. Prefix with - for descending sort order. Can be comma separated list of sort fieldsfields
- A map of attributes we only want to return in the result, i.e. skip all attributes not contained in the list the search would return otherwise.
The key of the map is the field name. The value can be a field operator like SUM, AVG, MIN or MAXdistinctValuesOnly
- fetches distinct/all values, use case is fetching distinct single column valuesAbstractProducer.ResultIterator stream(String typeCode, String sortBy, Filter... filters) throws Exception
typeCode
- A type code string of the type of the object to search for. All available type codes can be retrieved by calling /pricefx//fetch
sortBy
- Sort the results by an attribute. Prefix with - for descending sort order. Can be comma separated list of sort fieldsfilters
- A list of filter objects that are AND'ed togetherException
AbstractProducer.ResultIterator stream(String typeCode, String sortBy, List<String> fields, Filter... filters) throws Exception
typeCode
- A type code string of the type of the object to search for. All available type codes can be retrieved by calling /pricefx//fetch
sortBy
- Sort the results by an attribute. Prefix with - for descending sort order. Can be comma separated list of sort fieldsfields
- A list of attributes we only want to return in the result, i.e. skip all attributes not contained in the list the search would return otherwisefilters
- A list of filter objects that are AND'ed togetherException
AbstractProducer.ResultIterator stream(String typeCode, String sortBy, List<String> fields, boolean distinctValuesOnly, Filter... filters) throws Exception
typeCode
- A type code string of the type of the object to search for. All available type codes can be retrieved by calling /pricefx//fetch
sortBy
- Sort the results by an attribute. Prefix with - for descending sort order. Can be comma separated list of sort fieldsfields
- A list of attributes we only want to return in the result, i.e. skip all attributes not contained in the list the search would return otherwisedistinctValuesOnly
- fetches distinct/all values, use case is fetching distinct single column valuesfilters
- A list of filter objects that are AND'ed togetherException
AbstractProducer.ResultIterator stream(String typeCode, String sortBy, Map<String,String> fields, boolean distinctValuesOnly, Filter... filters) throws Exception
typeCode
- A type code string of the type of the object to search for. All available type codes can be retrieved by calling /pricefx//fetch
sortBy
- Sort the results by an attribute. Prefix with - for descending sort order. Can be comma separated list of sort fieldsfields
- A map of attributes we only want to return in the result, i.e. skip all attributes not contained in the list the search would return otherwise.
The key of the map is the field name. The value can be a field operator like SUM, AVG, MIN or MAXdistinctValuesOnly
- fetches distinct/all values, use case is fetching distinct single column valuesfilters
- A list of filter objects that are AND'ed togetherException
boolean emit(Object obj) throws InterruptedException
obj
- The object to be emitted/inserted in the emit queueInterruptedException
void emitRebateRecords(String dateFieldName, String sortBy, Filter... filters) throws InterruptedException
dateFieldName
- The name of the field to be substitued in the RebateRecord's calculationBase (a DMDataSlice object that includes a generic time dimension filter)sortBy
- The RebateRecord field on which to sortfilters
- The filters to apply to the RebateRecord searchInterruptedException
boolean emitPersistedObject(String typedId) throws InterruptedException
emitRebateRecords
.typedId
- The typedId of the PersistedObject to emitInterruptedException
boolean emitPersistedObject(String typeCode, Long id) throws InterruptedException
emitRebateRecords
.typeCode
- The typeCode of the PersistedObject to emitid
- The id of the PersistedObject to emitInterruptedException
int count(String typeCode, Filter... filters)
find(java.lang.String, com.googlecode.genericdao.search.Filter...)
methods, this method queries an arbitrary object type. It does not return the objects itself but the count.typeCode
- A type code string of the type of the object to search for. All available type codes can be retrieved by calling <hostname>/pricefx/<partition name>/fetch
filters
- A list of filter(java.lang.String, java.lang.Object)
objects that are AND'ed togetherLookupTable findLookupTable(String tableName)
tableName
- The name of the lookup tablenull
List<Object> findLookupTableValues(String tableName, Filter... filters)
tableName
- The name of the lookup tablefilters
- Optional extra filter(java.lang.String, java.lang.Object)
null
WorkflowInfo findWorkflowInfo(String approvableTypeCode, Object approvableId)
approvableTypeCode
- type code of approvable. Approvables are for instances quotes, rebate agreements, data change requests etc.approvableId
- id of the approvablenull
if not foundMap<String,Object> findPreviousApprovableState(String typedId, String... workflowStatuses)
typedId
- Approvable entity typed idworkflowStatuses
- Only 'DENIED' or 'WITHDRAWN' are supportedWorkflowInfo findPreviousWorkflowInfo(String typedId, String... workflowStatuses)
typedId
- Approvable entity typed idworkflowStatuses
- Only 'DENIED' or 'WITHDRAWN' are supportedList<CustomerAssignment> findCustomerAssignments(String customerId)
customerId
- The customer to search an assignment forList<Pricelist> findPricelists(Date targetDate, String listName)
targetDate
- The targetDate to uselistName
- Filter on list name. If null
the list name is not included in searchList<Simulation> findSimulations(Date targetDate, String simulationName)
targetDate
- The targetDate to usesimulationName
- Filter on simulation name. If null
the simulation name is not included in searchList<PriceGrid> findPriceGrids(Date targetDate, String priceGridName)
targetDate
- The targetDate to usepriceGridName
- Filter on price grid name. If null
the price grid name is not included in searchList<CalculatedFieldSet> findCalculatedFieldSets(Date targetDate, String cfsName)
targetDate
- Target date for the cfscfsName
- Filter on cfs name. If null
the cfs name is not included in searchList<ManualPricelist> findManualPricelists(Date targetDate, String listName)
targetDate
- The targetDate to uselistName
- Filter on list name. If null
the list name is not included in searchList<SummaryCalculableObjectItem> findApprovedPricelistItems(String sku)
sku
- The sku to filter onList<Customer> findCustomersInGroup(CustomerGroup group)
group
- The group to matchList<Customer> findCustomersInGroup(CustomerGroup group, int startRow, String sortBy)
group
- startRow
- The starting row number (only max 200 rows returned at once)sortBy
- A sort key. null
if no sorting is requiredObject getManualOverride(String elementName)
Note that the manualOverride works as a flag - when it is set for an element, the final value of that element is taken from the manually entered value and the calculation of that element does not run at all. If this flag is not set, the final value is the calculated result.
elementName
- The formula/result element that is overriddennull
if not overriddenvoid removeManualOverride(String elementName)
If you have a condition to remove the manual override, it is recommended to put this condition in a separate formula element which is always executed (not in the same one which has the manual override allowed; the reason is that once the user enters a value manually, the element calculation does run at all, so the condition would not be evaluated).
elementName
- The formula/result element that is overriddenvoid abortCalculation()
void throwException(String errorMessage) throws XExpression
errorMessage
- The error message that is displayedXExpression
void markItemDirty(String sku) throws XExpression
sku
- The item to mark dirtyXExpression
void markItemDirty(String sku, String key2) throws XExpression
sku
- key2
- XExpression
void markItemDirty() throws XExpression
XExpression
void markItemClean() throws XExpression
XExpression
void markItemClean(String sku, String key2)
sku
- key2
- void markItemClean(String sku)
sku
- boolean isSecondPass() throws XExpression
XExpression
int getIterationNumber() throws XExpression
XExpression
String formatString(String locale, String format, Object... args)
String.format(java.lang.String, java.lang.Object...)
.locale
- The locale (as string)format
- The format stringargs
- The arguments to pass onString formatNumber(String pattern, Object n)
NumberFormat
and DecimalFormat.applyPattern(java.lang.String)
.pattern
- The pattern stringn
- The number to formatString formatNumber(String locale, String pattern, Object n)
NumberFormat
and DecimalFormat.applyPattern(java.lang.String)
.pattern
- The pattern stringn
- The number to formatlocale
- The locae to use for formattingObject jsonDecode(String json)
json
- The input JSON stringObject jsonDecodeList(String json)
json
- The input JSON stringObject jsonEncode(Object input)
input
- The input object, usually mapObject jsonEncode(Object input, boolean omitNull)
input
- The input object, usually mapomitNull
- Should null values be omitted?void criticalAlert(String msg)
msg
- The alert messagevoid redAlert(String msg)
msg
- The alert messagevoid yellowAlert(String msg)
msg
- The alert messageResultFlexChart buildFlexChart(Object definition)
ResultFlexChart buildFlexChart(String baseTemplateToUse, Object definition)
FlexChart
from the passed definition
by
merging it with options
defined within the
baseTemplateToUse
template.
Although it may change in future releases, for now, a
FlexChart
is nothing else than a Highcharts
chart. Therefore the passed definition
(also applies to the
baseTemplateToUse
template) must denote
Highcharts options
- please consult Highcharts
documentation for more details on this.
Since Highcharts options
are normally specified by a
JavaScript object literal
, the passed
definition
must be either a JSON
string
representing such object literal
, or any object
which can be mapped to such JSON
representation. Therefore,
typically the definiton
will be passed as a
map of maps
. Example:
def definition = [ chart: [ type: "bar" ], title: [ text: "A common FlexChart" ], series: [ [ data: [10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21] ] ] ] api.buildFlexChart(definition)
Please note that not all Highcharts options
are supported!
Moreover, usage of some options is prohibited deliberately. These are
currently global
, events
and every
JavaScript function
-based options.
Note: FlexChart
templates are defined by administrator in
the 'Configuration
' section.
baseTemplateToUse
- the name of the template to use as a basis for merging with
the passed definition
; if null
, the
predefined Default template gets useddefinition
- the definition of the FlexChart
; currently, this
will typically be a string or map of maps containing
Highcharts options
FlexChart
,
baseTemplateToUse
and type of the result - which
will always be 'FLEXCHART', hereResultHighchart buildHighchart(Map<String,?> definition)
ResultHighchart
from the passed definition
.
FlexChart
, the definition is passed straight to the
Highcharts
library, currently release 6.1. There is no validation,
no templates merging, and JavaScript functions are not supported.definition
- the definition of the Highchart
as a map of maps and arraysResultHighmap buildHighmap(Map<String,?> definition)
ResultHighmap
from the passed definition
.
FlexChart
, the definition is passed straight to the
Highmaps
library, currently release 6.1. There is no validation,
no templates merging, and JavaScript functions are not supported.definition
- the definition of the Highmap
as a map of maps and arraysAdaptiveHistogram newAdaptiveHistogram()
ItemSummaryQuery<Pricelist> getPricelistSummaryQuery()
runSummaryQuery(ItemSummaryQuery)
.
This query runs against pricelist(s).ItemSummaryQuery<Simulation> getSimulationSummaryQuery()
runSummaryQuery(ItemSummaryQuery)
.
This query runs against simulation(s).ItemSummaryQuery<PriceGrid> getPriceGridSummaryQuery()
runSummaryQuery(ItemSummaryQuery)
.
This query runs against price grid(s).ItemSummaryQuery<RebateRecordSet> getRebateRecordSummaryQuery()
runSummaryQuery(ItemSummaryQuery)
.
This query runs against rebate records.List<Map<String,Object>> runSummaryQuery(ItemSummaryQuery<? extends CalculableObject> query)
query
- The query to executeConfiguratorEntry createConfiguratorEntry(InputType type, String name)
type
- Input type of the parameter. Valid enum values are:
PRODUCT, PRODUCTGROUP, CUSTOMER, CUSTOMERGROUP, USERENTRY, STRINGUSERENTRY, OPTION,
INTEGERUSERENTRY, BOOLEANUSERENTRY, DATEUSERENTRY, TIMEUSERENTRY, DATETIMEUSERENTRY, MULTITIERENTRY,
INPUTMATRIX, OPTIONS, MATRIXLOOKUP, LOOKUP, FILTERBUILDER, DMFILTERBUILDER, DMFIELD, DMDIMFILTER,
CONFIGURATOR, HIDDENname
- name of the parameterConfiguratorEntry createConfiguratorEntry(InputType type, String name, Date targetDate)
type
- Input type of the parameter. Valid enum values are:
PRODUCT, PRODUCTGROUP, CUSTOMER, CUSTOMERGROUP, USERENTRY, STRINGUSERENTRY, OPTION,
INTEGERUSERENTRY, BOOLEANUSERENTRY, DATEUSERENTRY, TIMEUSERENTRY, DATETIMEUSERENTRY, MULTITIERENTRY,
INPUTMATRIX, OPTIONS, MATRIXLOOKUP, LOOKUP, FILTERBUILDER, DMFILTERBUILDER, DMFIELD, DMDIMFILTER,
CONFIGURATOR, HIDDENname
- name of the parametertargetDate
- Target date for the input parameter (not applicable to all input types)ConfiguratorEntry createConfiguratorEntry()
ConfiguratorEntryArray createConfiguratorEntryArray(Object... entries)
entries
- 0..N configurator entries. Supports also list nestingConfiguratorEntryArray#addEntry(ConfiguratorEntry)
,
ConfiguratorEntryArray#setEntries(List)
or
ConfiguratorEntryArray#getEntries()
Object configurator(String configuratorName, String formulaName)
configuratorName
- The name of the configurator. Similar to other options' namesformulaName
- The name of the configurator's formula which is used to drive the input selectionsObject configurator(String configuratorName, String formulaName, Object resultName)
configuratorName
- The name of the configurator. Similar to other options' namesformulaName
- The name of the configurator's formula which is used to drive the input selectionsresultName
- The result that should be returned (instead of the full configurator results map)Object configurator(String configuratorName, String formulaName, Object width, Object height)
configuratorName
- The name of the configurator. Similar to other options' namesformulaName
- The name of the configurator's formula which is used to drive the input selectionswidth
- The width of the configurator window. Can be a number (in pixels) or a percentage string.height
- The height of the configurator window. Can be a number (in pixels) or a percentage string.Object inlineConfigurator(String configuratorName, String formulaName)
configuratorName
- The name of the configurator. Similar to other options' namesformulaName
- The name of the configurator's formula which is used to drive the input selectionsDate parseDate(String pattern, String date)
Hint: For parsing datetimes (i.e., dates also including information about the time of day), use the parseDateTime(String, String)
method instead.
pattern
- pattern for parsing (see DateTimeFormat for pattern format specification)date
- date as string in format specified by the pattern
DateTime parseDateTime(String pattern, String datetime)
Important note: This method will use the UTC time zone for parsing (unless the provided pattern
usees a syntax explicitly
specifying a time zone). If a different time zone is required, please use the parseDateTime(String, String, int, int)
method which allows to
set a time zone by providing an offset to UTC in hours and minutes.
pattern
- pattern for parsing (see DateTimeFormat for pattern format specification)datetime
- datetime as string in format specified by the pattern
DateTime parseDateTime(String pattern, String datetime, int tzHoursOffset, int tzMinutesOffset)
Important note: This method will always use the provided time zone, regardless of the possible time zone set explicitly in datetime
.
pattern
- pattern for parsing (see DateTimeFormat for pattern format specification)datetime
- datetime as string in format specified by the pattern
tzHoursOffset
- the offset in hours from UTC, from -23 to +23tzMinutesOffset
- the offset in minutes from UTC, from -59 to +59Filter createElementNameFilter(String elementName, Object fieldValue, String... listTypedIds)
elementName
- The element name (originates from formula element name or MPL integration tag)fieldValue
- The value (= oprtator applied) of that attributelistTypedIds
- A list of typedId of the "header" objects. E.g. 34.PL. Supported type codes are PL, MPL, PG and SIMMap<String,Object> getItemCompleteCalculationResults(String typedId)
Note: These are not returned when using other methods (e.g., pricelistItem(String, String)
)
typedId
- typedId of the item, e.g. 34.PLI. Supported type codes are PLI, XPLI, SIMI, XSIMI, PGI, XPGI and RRMap<String,Object> getItemActiveCalculationResults(String typedId)
typedId
- typedId of the item, e.g. 34.PLI. Supported type codes are PGI and XPGIObject httpCall(String url, String body) throws XExpression
url
- full url to the endpoint (https or http)body
- body of the requestXExpression
Object boundCall(String uniqueName, String relativeUrl, String body, Boolean... responseBodyAsAString) throws XExpression
uniqueName
- unique name of bound partition. See Configuration/Bound PartitionsrelativeUrl
- relative URL to Price f(x) server command. First slash excluded.body
- body of the requestresponseBodyAsAString
- if first param is true, than the body is not converted to json but returned as a stringXExpression
Object getBoundPartitionNames()
Object httpCall(String url, String body, String methodType, String contentType, Map... properties) throws XExpression
url
- - full url to the endpoint (https or http)body
- body of the requestmethodType
- "Get"
or "Post"
contentType
- "JSON"
"XML"
or any full content type for instance "text/plain"
properties
- map of properties. Following are allowed:
String
value - user name for basic authenticationString
value - user password for basic authenticationboolean
value - Ignores invalid certificates. Use for testing https connections only. Not for production use.String
value - user name for proxy (if any)String
value - user password for proxy (if any)String
value - full url to proxyMap
value - a sub-map that then will add these headers verbatim to the requestXExpression
Object add(String typeCode, Map<String,Object> values)
typeCode
- A type code string of the type of the object to search for. All available type codes can be retrieved by calling <hostname>/pricefx/<partition name>/fetch
values
- key-value pairs representing fields of object we want to add. Note that all significant fields have to be present.null
if error occurredObject addOrUpdate(String typeCode, Map<String,Object> values)
typeCode
- A type code string of the type of the object to search for. All available type codes can be retrieved by calling <hostname>/pricefx/<partition name>/fetch
values
- key-value pairs representing fields of object we want to add or update. Note that all significant fields have to be present.Object update(String typeCode, Map<String,Object> values)
Examples:
api.addOrUpdate("PX", ["name": "Scoring_MM", "sku": sku]) api.addOrUpdate("PGI", ["priceGridName" : "LifeCycleMonitor", "sku" : currentItem.sku, "label" : currentItem.label]) def large = ["lookupTableId": pp.id, "lookupTableName": pp.uniqueName, "name": "L", "attribute1": percentileHigh, "attribute2": "999999999"] api.addOrUpdate("MLTV", large)
typeCode
- A type code string of the type of the object to search for. All available type codes can be retrieved by calling <hostname>/pricefx/<partition name>/fetch
values
- key-value pairs representing fields of object we want to update. Note that all significant fields have to be present.null
if error occuredObject delete(String typeCode, Map<String,Object> values)
Example:
api.delete("PX", ["id": existingRecord, "name": "ActivePrice"])
typeCode
- A type code string of the type of the object to search for. All available type codes can be retrieved by calling <hostname>/pricefx/<partition name>/fetch
values
- key-value pairs representing significant fields of object we want to delete. Note that all significant fields have to be present, if not the id has to be presentnull
if error occuredvoid sendEmail(String to, String subject, String message)
to
- email address the email is sent tosubject
- email subjectmessage
- email bodyvoid customEvent(Object object)
object
- The object to pass along with the eventvoid customEvent(Object object, String customEventType)
object
- The object to pass along with the eventcustomEventType
- A custom string to classify the event type (as the general event type is always CUSTOM)void customEvent(Object object, String customEventType, String operation)
object
- The object to pass along with the eventcustomEventType
- A custom string to classify the event type (as the general event type is always CUSTOM)operation
- One of these strings: UPDATE,DELETE,ADD,ITEMCHANGEvoid customEvent(Object object, String customEventType, String operation, boolean omitNullValues)
object
- The object to pass along with the eventcustomEventType
- A custom string to classify the event type (as the general event type is always CUSTOM). Can be null.operation
- One of these strings: UPDATE,DELETE,ADD,ITEMCHANGE. Can be null.omitNullValues
- Also include keys that have a null value (false) or omit them (true). True is the default for other method signatures that do not explicitly specify that value.Object updateCalculableObjectHeader(String calcObjTypeCode, String calcObjName)
calcObjTypeCode
- Type code of object to updatecalcObjName
- (Numeric) Id of object to updateAttributedResult attributedResult(Object result)
AttributedResult
object to be returned as a result of an output element.
Since AttributedResult
is configurable, it's used in cases where it's not sufficient to only return a
plain value, but it's also required to adjust formatting, e.g., color, whether the value will display underlined, etc.
The usage is simple, instead of returning the output value, create a new AttributedResult
instance like this:
api.attributedResult(plain value)
, customize it by calling its various methods, and return it finally.
Sample code:
def cost = api.getElement("Margin_pct")
return api.attributedResult(cost)
.withBackgroundColor(cost < 0.30 ? "red" : "#0101DF")
.withSuffix(cost < 0.30 ? "!!!" : null)
.withTextColor(cost < 0.30 ? "white" : null)
.withTextDecoration(cost < 0.30 ? "underline" : null)
result
- calculation resultAttributedResult - for details on formatting
WrappedResult wrap(Object result)
ResultMatrix newMatrix()
ResultMatrix newMatrix(String... columns)
The individual cells can be styled via the use of: - linkCell(Object value,String targetPage, String targetPageState) - imageCell(Object imageUrl) - styledCell(Object value, String textColor,String bgColor, String weight, String alignment) - styledCell(Object value, String textColor,String bgColor, String weight) - styledCell(Object value, String textColor,String bgColor) - setColumnFormat(String column, FieldFormatType fft) Valid FieldFormatTypes are: NUMERIC, NUMERIC_LONG, MONEY, PERCENT, TEXT, MONEY_EUR, MONEY_USD, MONEY_GBP, MONEY_JPY, MONEY_CHF, MONEY_PLN, DATETIME, DATE, INTEGER
Sample code:
def resultMatrix = api.newMatrix("Margin Status","Customer Id","Name","Net Margin %") def i=0 for(entry in rawValues.getEntries()) { def row =[:] row.put("Customer Id",resultMatrix.linkCell(entry.get("CustomerID"),"customersPage",entry.get("CustomerID"))) row.put("Name",entry.get("CustomerName")) def margin = entry.get("NetMargin%")/100 row.put("Net Margin %",resultMatrix.styledCell(margin,"#FF0000",null,"bold")) if(margin <= 0) row.put("Margin Status",resultMatrix.imageCell("/images/small_trafficlight_red.png")) if(margin <0.1 && margin > 0) row.put("Margin Status",resultMatrix.imageCell("/images/small_trafficlight_yellow.png")) if(margin >=0.1 ) row.put("Margin Status",resultMatrix.imageCell("/images/small_trafficlight_green.png")) resultMatrix.addRow(row) i++ if(i>10) break; } resultMatrix.setColumnFormat("Net Margin %",FieldFormatType.PERCENT) return resultMatrix
columns
- The initial set of columns for the result matrixResultMatrix newMatrix(Collection<String> columns)
columns
- The initial set of columns for the result matrixnewMatrix(String... columns)
ResultGauge newGauge()
def g = api.newGauge() g.addSector(5,"#FF0000") g.addSector(25,"#FFFF00") g.addSector(null,"#00FF00") g.setValue(10)
DashboardController newController()
def controller = api.newController() controller.addButton(label,targetPage,targetPageState) controller.addHTML(label,someValidHTML)
Filter walkFilter(Filter filter, Closure<?> visitBefore, Closure<?> visitAfter, boolean removeNulls)
removeNulls
is consulted only in case of
(sub)filters which take a list of sub filters.
Hence, this method may be used in many cases. For instance, you could use it for mapping the current property set to another one, e.g. to convert a PB filter to a PA one. Somehow like this:
def propertyMappings = ["sku": "ProductID"] api.walkFilter(pbFilter, null, { filter -> if (filter != null && propertyMappings[filter.property] != null) filter.property = propertyMappings[filter.property] filter }, false);
Object findDataLoad(String dataLoadLabel, String dataLoadType, String target)
dataLoadLabel
- Label of DMDataLoad as seen in Data load UIdataLoadType
- Load Type of DMDataLoad as seen in Data load UI. Namely:
target
- Target of DMDataLoad as seen in Data load UIObject findRebateRecordLoad(String rebateRecordLoadLabel)
rebateRecordLoadLabel
- Label of rebate record load as seen in Rebate Record UIString currentPartitionName()
DateTimeZone getTimeZone(String tzString)
tzString
- String uuid(int len)
len
- the desired number of charactersString uuid(int len, int radix)
len
- the desired number of charactersradix
- the number of allowable values for each character (must be <=
62)String uuid()
MultiKey<Object> multiKey(Object... keys)
keys
- Key valuesMap<String,String> roles()
String entityRef(PartitionedObject po) throws IllegalAccessException
IllegalAccessException
double evalExpression(String mathExpression)
+
-
*
/
^
sqrt
Example:
evalExpression("((10 - 3^2 + 1) * -sqrt(1*2+3*4)) / 4")
mathExpression
- mathematical expressionvoid setSharedCache(String key, String value)
key
- The cache keyvalue
- The value to storeString getSharedCache(String key)
key
- The cache keyvoid removeSharedCache(String key)
key
- The cache keyString base64Encode(String string)
string
- The base64 encoded stringString base64Decode(String base64String)
base64String
- The clear text stringList<?> getProductReferences(String typeCode, Set<String> skus)
typeCode
- Must be either "Q" or "RBA" for nowskus
- A set of SKU strings that should be searched forString getLocale()
String getBaseURL()
CreationWorkflowDefinition newCreationWorkflow()
CreationWorkflowStepDefinition newCreationWorkflowStep()
Map<String,List<String>> findNextRevUNs(String typeCode, String... uniqueNames)
typeCode
- "Q" or "CT" or "RBA"uniqueNames
- var args of Q/CT/RBA uniqueNamesBoolean isFullListCalculation()
null
is returned if method is not applicableLong triggerPriceGridCalculation(Long priceGridId, Map<String,Object> parameters)
priceGridId
- ID of PriceGrid to calculateparameters
- Optional job parametersLong triggerCFSCalculation(Long cfsID)
cfsID
- ID of CalculatedFieldSetCopyright © 2018. All rights reserved.