D Appendix: Application Specific Custom Functions, Procedures, and Expressions

Assortment Planning Cloud Service uses the RPAS Enterprise Edition Batch Framework to set up the batch process. Refer to the Oracle Retail Assortment Planning Cloud Service Implementation Guide for more details about understanding batch_control files and its uses in the batch process. Any application-specific custom functions are packaged in the RPAS Applications Standard Library (RASL) libraries and those are available to use in the batch_exec_list.txt control file with the service name as ra_custom to trigger those functions and parameter as the function name. The following list of predefined custom functions are available RASL libraries installed as part of RPAS that are used by Item Planning.

This appendix also contains details about special procedures/expressions used in the APCS configuration.

Custom Function: rms_clnd_label

RMFCS interfaces the calendar hierarchy file (rms_clnd.csv.dat), but does not include any calendar labels. This function formats the file, filters the required columns for the APCS GA calendar hierarchy, and adds the calendar labels. There is no additional parameter needed for this function call, but this requires the RMFCS calendar file to be present in the cloud share location with the name rms_clnd.csv.dat. After the call, this function creates the calendar hierarchy file clnd.csv.dat in the domain input directory for the subsequent hierarchy load process.

Example:

batch_rms_xform | ra_custom | rms_clnd_label

Custom Function: ap_set_datr

The Platform UI feature allows product attributes to be assigned during item creation if the attributes are defined as dimension attributes. This application-level function registers all the loaded product attributes as dimension attributes. It needs to be called each time a new set of product attributes is loaded.

Example:

batch_datr | ra_custom | ap_set_datr

Custom Function: ap_load_strc

This custom function allows transforming the AI Foundation Location Cluster file into the required location cluster file format. It also loads the location cluster file.

Example:

batch_strc | ra_custom | ap_load_strc

Custom Function: ap_exp_rms_item

This custom function is used to export new items to RMFCS in XML format. It merges and formats the exported files into XML format and uploads to Object Storage.

Example:

exp_rms | ra_custom | ap_exp_rms_item

Custom Function: ap_set_rms_dim

This custom function is used to link the dimension in the domain to the RMFCS item dimension. It sets the domain property, rms_im_levels, with dimension mappings passed as a parameter. If the domain is linked with RMFCS and dimensions are mapped with the example call shown below, then any new DPM positions created for those dimensions will use the reserved numbers from RMFCS for that mapped item. More than one dimension can be mapped using following mapping "rpasDimName:rmsDimName,...".

Example:

set_rms_sib | ra_custom | ap_set_rms_dim~sku:ITEM,skup:ITEM

Custom Function: ap_exp_alloc

This custom function formats the Standard Exports to the Allocation’s system into the required format, reads the exported file ap_to_alloc.txt and formats, and converts the file as p0itpt.01 (Style only items) or p1itpt.01 (for Style/Color) and uploads to Object Storage.

Example:

exp_alloc | ra_custom | ap_exp_alloc

Custom Function: ap_sib_color

This custom function is used to rename the Style/Color positions using the Style:<color attribute name> format for newly created DPM positions as needed by RMFCS integration so that if actual positions are integrated, it will be formalized.

It expects the ap_sib_color.dat file containing the DPM style/color position, style position, and color attribute in the temp directory. It creates the required product hierarchy renaming the file from it and calls eebatch_rename_positions.ksh to rename those positions.

No additional inputs required to call this function.

Example:

batch_sib | ra_custom | ap_sib_color

Custom Function: load_udd

This custom function can be used to load any User Defined Dimension (UDD). It internally calls the loadUdd utility to load the custom User Defined Dimension from a file. It can be used to customize the batch process if the customer wants to load any User Defined Dimension as part of their batch process. This function expects only one parameter and it should be the UDD name. It also expects the customer to upload a CSV file to their Object Storage location as <UDD>.csv.dat. If the file is not present, it will ignore with a warning in the logs. Only one UDD can be loaded from a single file. The UDD file should only have three columns. First column should be the base parent dimension position for UDD, second column should be the UDD position name, and third column should be the UDD position label.

Example:

load_udd | ra_custom | load_udd~stdb

Custom Function: set_stdb

This custom function can be used to automatically set the STDB User Defined Dimension (UDD) dynamically based on RPAS_TODAY with values STD/BTA. It expects the STDB User Defined Dimension to be present in the calendar hierarchy and it should be a rollup of the week dimension. STD is set as the value for elapsed periods and BTA as the value for unelapsed periods based on RPAS_TODAY used in the domain. It internally generates the UDD file and calls the custom function load_udd to load the same.

This function takes two optional parameters to override the labels that need to be used for STD and BTA positions. If not provided, it will use the position name as the labels. If the optional parameters are provided, it will use the custom labels provided to this function call as the parameter. If there are spaces in the labels, then provide the parameters within double quotation marks.

Example:

load_hier | ra_custom | set_stdb

or

load_hier | ra_custom | set_stdb~"Elapsed Weeks"~"Unelapsed Weeks"

Custom Function: key_lookup

This custom function can be used to look up key mapping columns and replace it with key position names in an input file. Key mappings for the key positions can be defined as a single dimensional measure and that can be passed as an input. For matched mapping columns, this function replaces it with the key position values. Typical use case for this function is in an integration if the source application is using different key position names and key positions than used in the RPASCE application and if the keys need to be replaced before processing within the RPASCE solution, this function can be used, if the mappings are available in a measure. Example use case in GA is, AI Foundation uses different sub-class id and class-id than used by the Planning solutions when integrated with RMFCS. If an interface from AI Foundation uses sub-class id in the format of AI Foundation, it can be transformed to use the sub-class id keys used in Planning, if the customer can load the mapping with the sub-class id in Planning to AI Foundation in a single dimensional mapping measure.

This function takes three parameters, Input File Name, Position of the column where the dimension needs to be changed, and the Mapping measure name.

Example: a sample file from AI Foundation (for example, test.csv.ovr) with sub-class id as the first column:

SBC~100~1000~1001,1,232

SBC~100~1000~1001,2,252

SBC~200~1000~1001,1,343

SBC~200~1000~1001,2,533

If the mapping measure adhdpsclst is defined within the application at the sub-class level with following mapping information for the subclass:

1001001, SBC~100~1000~1001

2001001, SBC~200~1000~1001

For the above example, if the function is called in the batch control file:

batch_test | ra_custom | key_lookup~test.csv.ovr~1~adhdpsclst

After transformation, the same file should be:

1001001,1,232

1001001,2,252

2001001,1,343

2001001,1,533

This function looks up the input files in the following directories in the order of Object Storage and RPAS_CUST_ROOT/temp. If files are found, it will do the transformation, otherwise, it will abort for file not found. If the mapping measure is empty, it will not do any transformation. If the mappings are not found, it will also not do the transform for those keys. The transformed file will be present in <DOMAIN>/input and RPAS_CUST_ROOT/temp with the same name, so that the customer can use the same transformed file in batch for subsequent file processing (either to load that file or do further data transformations).

Special Expressions and Procedures Used in APCS Configuration

This section contains details about the special expressions that are not standard RPAS expressions/procedures but are used in the APCS configuration.

AttributesPickListExpr - Attribute Picklist Expression

This procedure is used to determine a picklist of values from a base string measure along the positions of the specified hierarchy. It also takes in a Filter Boolean as input to control which intersections are to be used to pick data for the picklist.

Syntax:

OUTMEAS <- AttributesPickListExpr(FILTERMEAS, INPUTMEAS, HIER, OUTFORMAT)

Example:

ADHDLikePoCT <- AttributesPickListExpr(ADHDLikePoCB,ADHDLikePoCL, "LOC", "0")

Expression Parameters:

The following table shows the parameter details for the expression.

Parameter Name Parameter Type Data Type Description

OUTMEAS

Output

String

Output Picklist Measure which will be a string value.

INPUTMEAS

Input

String

Input String Measure containing the picklist values stored along a hierarchy.

FILTERMEAS

Input

Boolean

Boolean measure with the same intersection of OUTMEAS. It should be set to true for the intersections picklist that needs to be created.

HIER

Input

String

Hierarchy Name specified as a String constant along which the picklist values need to be used. This hierarchy should be present in INPUTMEAS.

OUTFORMAT

Input

String

Output format with valid values "0" or "1". Using "0" will create a picklist using position names as picklist internal names and labels as attribute values. "1" will create a picklist using position values as name and labels for the picklist.

BopEopCalcExpr - Inventory Roll Calculation Expression

All planning applications typically need to create some batch rules to do inventory roll operations for all their actualized positions. Inventory roll calculations involve Beginning Inventory (BOP) and Ending Inventory (EOP) metrics, where BOP is calculated as lag of EOP (previous periods EOP) and EOP will be calculated from that period BOP plus additional metrics (Receipts, Sales, and so on). RPAS supports the use of the lag function to calculate BOP and creation of a separate expression to calculate EOP.

They normally run as cyclic rules in a batch rule group. Problem is this dual cyclic expression is highly performance intensive if it needs to roll inventory at the item/sku/store level. This is an optimized procedure to do inventory rollup calculations as a single expression instead of using them as cyclic expressions. This procedure can be used only in batch mode and should not be used in workbook calculation cycle rule groups.

Syntax:

EOP:<MEAS>,BOP:<MEAS> <- BopEopCalcExpr(TODAYINDEX:<MEAS>, INCEOP:<MEAS>, ACTEOP:<MEAS>, TSMASK:<MEAS>, INITIALBOP:<MEAS>)

Example:

EOP:ISWPEOPU,BOP:ISWPBOPU <- BopEopCalcExpr(TODAYINDEX:DRDVUnElapI, INCEOP:ISDVEOPU, ACTEOP:DRDVEOPU, TSMASK:DRDVEOPB, INITIALBOP:DRDVBOSU)

The above expression is equivalent to running the following two expressions in batch as a cyclic rule group:

ISWPBOPU = if (DRDVEOPB, if (current == first, DRDVBOSU, lag(ISWPEOPU)), ignore)

ISWPEOPU = if (DRDVEOPB, if (DRDVUnElapB, ISWPBOPU + ISDVEOPU, DRTYEOPU), ignore)

Expression Parameters:

The following table shows the parameter details for the expression.

Parameter Name Parameter Type Data Type Description

EOP

Output

Real

Calculated Ending Inventory value measure.

BOP

Output

Real

Beginning Inventory value measure, same intersection as EOPMEAS.

ACTEOP

Input

Real

Actual Ending Inventory for Elapsed Periods. Same Intersection as BOP and EOP.

INCEOP

Input

Real

Incremental Inventory value for UnElapsed Periods. Same intersection as BOP and EOP.

TODAYINDEX

Input

Integer

Index of Current RPAS Today period. Periods above this will be copied with actual EOP, periods after this will be calculated with BOP and Incremental EOP. Base Intersection higher or equal to BOP/EOP but should not have the calendar dimension.

TSMASK

Input

Boolean

Intersections to which inventory roll calculations need to be performed. Same intersection as BOP and EOP but without calendar dimension.

INITIALBOP

Input

Real

First Period Beginning Inventory value measure. Same Intersection of BOP and EOP but without the calendar dimension.

ClusterExpr - Cluster Expression

This procedure is used to define a dynamic cluster based on input parameters.

Syntax:

POINTMEMBERSHIP: <MEAS>, POINTMEMBERSHIPSTR: <MEAS>, CENTROID: <MEAS> <- ClusterExpr(MEASURE: <MEAS>, METHOD: <STRING>, NUMCLUSTERS: <MEAS>, CLUSTERHIER: <HIER>, BYGROUPDIMS: <DIMENSION>)

Example:

POINTMEMBERSHIP: SCDVBangGrpID, POINTMEMBERSHIPSTR: SCDVBangGrpT, CENTROID: SCDVBangGrpX <- ClusterExpr(MEASURE: SCDVCmbIdxV, METHOD: "BANG", NUMCLUSTERS: SCHDMaxPrfGrpU, CLUSTERHIER: "LOC", BYGROUPDIMS: "CHNL")

Expression Parameters:

The following table shows the parameter details for the expression.

Parameter Name Parameter Type Data Type Description

POINTMEMBERSHIP

Output

Integer

Output Cluster Group Id at Location level.

POINTMEMBERSHIPSTR

Output

String

Output Cluster Group String at Location level.

CENTROID

Output

Real

Output Centroid value at Aggregate level.

MEASURE

Input

Real

Input Score measure at Location level.

METHOD

Input

String

String constant with valid value, "BANG" for Bang Algorithm to use.

NUMCLUSTERS

Input

Integer

Number of Clusters to Create at Aggregate of Location level.

CLUSTERHIER

Input

String

String constant with hierarchy name of Location hierarchy for which cluster is created.

BYGROUPDIMS

Input

String

String constant of dimension name in Location hierarchy at Aggregate level.

CMNewItemSimilarityV2Expr - Item Similarity Expression

This procedure is a wrapper procedure used for calling AI Foundation functions which calculate the Item Similarity Scores based on Product Attributes and Product Attribute Weights. This similarity score can be internally calculated and used in Demand Transference procedures as input to determine the Demand Transference across similar items. It is also used in Assortment Improvement Procedures using Demand Transference.

Syntax:

SIM_OUT <- CMNewItemSimilarityV2Expr(SIM_IN, PROD_ATTR, ATTR_WGT, DT_MODE, FUNC_FIT, SAME_ITEM_MAP, VALID_ATTR, SIM_MODE)

Example:

BWHDSimOutVp <- CMNewItemSimilarityV2Expr(BWHDSimInV, ADDVPrdAttT, BWHDAttrWgtV, DRDVDTModeX, BWHDFuncFitB, DRDVSkupMapB, BWHDPrdAttB, DRDVSimModeV)

Expression Parameters:

The following table shows the parameter details for the expression.

Parameter Name Parameter Type Data Type Description

SIM_OUT

Output

Real

Similarity score across LHS and RHS Items at Item/Cluster/RHS Item level.

SIM_IN

Input

Real

It is needed only if a different Similarity Mode other than 0 is used. For default Similarity Mode 0, this can be initialized to 0 which calculates similarity for all items.

PROD_ATTR

Input

String

Product Attribute values at Item/Product Attribute level.

ATTR_WGT

Input

Real

Attribute Weight at Item/Attribute level.

DT_MODE

Input

Integer

Demand Transference Mode to calculate the similarity scores, value of 4 is for calculating Bi-Directional Similarity Score, 3 for One Directional Score.

FUNC_FIT

Input

Boolean

Functional Fit Boolean at Sub-Class/Product Attribute level.

SAME_ITEM_MAP

Input

Boolean

Same Item mapping across LHS-RHS Items at LHS-RHS Item level.

VALID_ATTR

Input

Boolean

Product Attribute Eligibility at Sub-Class/Attribute level.

SIM_MODE

Input

Real

Similarity mode at sub-class level with default value as 0 for similarity values calculating for all items.

CMDemandSignTranV2Expr - Demand Transference Expression

This procedure is a wrapper procedure used for calling AI Foundation functions which in turn calculate the Demand Transferences and Substitutable Sales Units. It also calculates the significant similar items and substitutable sales percentage against each similar item based on the similarity scores. It internally calculates the similarity scores using the attribute inputs and uses it to calculate the Demand transference outputs.

Syntax:

DT_SIG_SKU_COUNT, DT_SIG_SUB_PCT, DT_SALES, DT_SUB_SALES <- CMDemandSignTranV2Expr(DT_MASK, SIM_OUT, ITEM_KAD, INPUT_SALES, SAME_ITEM_MAP, ASSORT_ELASTICITY, DT_CUTOFF, DT_GUARD, PROD_ATTR, ATTR_WGT, SIM_MODE, FUNC_FIT, VALID_ATTR)

Example:

BWHDDTSigSkuV, BWHDDTSigSkuVp, BWHDDTSlsU, BWHDDTSubSlsU <- CMDemandSignTranV2Expr(BWHDRunMaskB, BWH1SimOutVp, BWHDDTKADX, BWHDDTROSU, DRDVSkupMapB, BWHDAssrtElasV, DRDVDTCutOffVp, DRDVDTGuardB, ADDVPrdAttT, BWHDAttrWgtV, DRDVSimModeV, BWHDFuncFitB, BWHDPrdAttB)

Expression Parameters:

The following table shows the parameter details for the expression.

Parameter Name Parameter Type Data Type Description

DT_SIG_SKU_COUNT

Output

Integer

Significant Substitutable Items count at Item/Cluster level.

DT_SIG_SUB_PCT

Output

Real

Significant Sku Substitutable Percentage at Item/Cluster/RHS Item level.

DT_SALES

Output

Real

Demand Transference ROS/Sales at Item/Cluster level (At same level of input ROS).

DT_SUB_SALES

Output

Real

Substitutable ROS/Sales at Item/Cluster level.

DT_MASK

Input

Boolean

Mask at Sub-class/Cluster level for which DT needs to be calculated.

SIM_OUT

Input

Real

It is needed only if different Similarity Mode other than 0 is used. For default Similarity Mode 0, this can be initialized to 0 procedure internally calculates similarity for all items.

ITEM_KAD

Input

Integer

Item Keep/Add/Drop Status with valid values as 1 for Add, 2 for Keep, and 3 for Drop Status of Items at Item/Cluster level.

INPUT_SALES

Input

Real

Initial Forecasted/Historical Sales or Rate of Sales at Item/Cluster level.

SAME_ITEM_MAP

Input

Boolean

Same Item mapping across LHS-RHS Items at LHS-RHS Item level.

ASSORT_ELASTICITY

Input

Real

Assortment Elasticity at Sub-Class/Cluster level.

DT_CUTOFF

Input

Real

DT Cut-Off % at Sub-Class/Cluster level.

DT_GUARD

Input

Real

DT Guard Boolean at Sub-Class/Cluster level.

PROD_ATTR

Input

String

Product Attribute values at Item/Product Attribute level.

ATTR_WGT

Input

Real

Attribute Weight at Item/Attribute level.

SIM_MODE

Input

Real

Similarity mode at sub-class level with default value as 0 for similarity values calculating for all items.

FUNC_FIT

Input

Boolean

Functional Fit Boolean at Sub-Class/Product Attribute level.

VALID_ATTR

Input

Boolean

Product Attribute Eligibility at Sub-Class/Attribute level.

CMAssortImprovementV2Expr - Assortment Improvement using DT Expression

This procedure is a wrapper procedure used for calling AI Foundation functions which in turn use the Demand Transferences and suggest the Improved Assortments after applying Demand Transferences based on the input assortment improvement parameters.

Syntax:

OPT_ASSORT, OPT_SALES <- CMAssortImprovementV2Expr(DT_MASK, INIT_SALES, SAME_ITEM_MAP, SIM_OUT, NEW_ITEM, INIT_ASSORT, IMPROVE_METRIC, ELIGIBLE_ITEM, IMPROVE_COUNT, MIN_TO_KEEP, OPT_MODE, ASSORT_ELASTICITY, ITEM_MANDATORY, OPT_TARGET, PROD_ATTR, ATTR_WGT, SIM_MODE, FUNC_FIT, VALID_ATTR)

Example:

BWHDDTImprAsrtB, BWHDDTImprAsrtU <- CMAssortImprovementV2Expr(BWHDRunMaskB, BWHDDTInitAsrtU, DRDVSkupMapB, BWH1SimOutVp, BWHDDTNewB, BWHDDTInitAsrtB, BWHDDTMetricImprV, BWHDDTEligB, BWHDDTImprAsrtV, BWHDMinKeepVp, BWHDDTOptModeV, BWHDAssrtElasV, BWHDDTMandB, BWHDDTOptTgtV, ADDVPrdAttT, BWHDAttrWgtV, DRDVSimModeV, BWHDFuncFitB, BWHDPrdAttB)

Expression Parameters:

The following table shows the parameter details for the expression.

Parameter Name Parameter Type Data Type Description

OPT_ASSORT

Output

Boolean

Optimized Assortment after adding/removing items based on input parameters at Item/Cluster level.

OPT_SALES

Output

Real

Optimized Sales/ROS by calculating Improved Assortment after applying Demand Transference at Item/Cluster level.

DT_MASK

Input

Boolean

Mask at Sub-class/Cluster level for which Optimized Assortment needs to be calculated.

INIT_SALES

Input

Real

Initial Forecasted or Historical Sales or ROS at Item/Cluster level for all eligible items. It needs Sales/ROS for both historical and new items.

SAME_ITEM_MAP

Input

Boolean

Same Item mapping across LHS-RHS Items at LHS-RHS Item level.

SIM_OUT

Input

Real

It is needed only if different Similarity Mode other than 0 is used. For default Similarity Mode 0, this can be initialized to 0 procedure internally calculates similarity for all items.

NEW_ITEM

Input

Boolean

New Items within the Assortment at Item/Cluster level.

INIT_ASSORT

Input

Boolean

Initial Planned Assortment before running Assortment Improvement at Item/Cluster level.

IMPROVE_METRIC

Input

Real

Metric to Improve, 1.0 for Sales Units (at same level of input ROS/Sales). For Sales Retail or Gross Margin, multiply it with Sales Price or Price Margin at Item/Cluster level.

ELIGIBLE_ITEM

Input

Boolean

All Eligible Items that can be included into the assortment for improvement at Item/Cluster level.

IMPROVE_COUNT

Input

Integer

Number of Items to be added, removed, or swapped from the assortment at Sub-Class/Cluster level.

MIN_TO_KEEP

Input

Real

Minimum Percentage of Initial Assortment to Keep during Assortment Improvement at Sub-Class/Cluster level.

OPT_MODE

Input

Integer

Optimization Mode with values 1 for Add with Swap, 2 for Drop with Swap, 3 for Swap, 4 for Add, and 5 for Remove at Sub-Class/Cluster level.

ASSORT_ELASTICITY

Input

Real

Assortment Elasticity at Sub-Class/Cluster level.

ITEM_MANDATORY

Input

Boolean

Mandatory Items to Keep after running Assortment Improvement at Item/Cluster level.

OPT_TARGET

Input

Real

Target to Achieve by Swapping assortments at Sub-Class/Cluster level.

PROD_ATTR

Input

String

Product Attribute values at Item/Product Attribute level.

ATTR_WGT

Input

Real

Attribute Weight at Item/Attribute level.

SIM_MODE

Input

Real

Similarity mode at sub-class level with default value as 0 for similarity values calculating for all items.

FUNC_FIT

Input

Boolean

Functional Fit Boolean at Sub-Class/Product Attribute level.

VALID_ATTR

Input

Boolean

Product Attribute Eligibility at Sub-Class/Attribute level.