We have been using functions like DIMIX, ELISANC, … for ages in rules and Turbo Integrator. While these functions can often be made hierarchy-aware (e.g. DIMSIZ( ‘Customer:By Region’ )), a new set of functions was developed. In the examples given it would be Elementindex and ElementIsAncestor. Or consider the example of DIMENSIONELEMENTINSERT that turns into HIERARCHYELEMENTINSERT.
Similar arguments, but in general the dimension parameter receives a second argument for the hierarchy name.
Below is my own list of regular expressions to swap out the older function names for the newer function names.
Maybe a collective effort within the TM1 community could extend and optimize this list ? Any regex pro’s out there ?
CAVEATS:
- functions with the dim:hier construct cannot be identified !
- constructs like DType( '}ElementAttributes_' | vDim are not found entirely, the regex stops at the pipe symbol.
Code: Select all
# hierarchy-aware functions
DIMSIZ
------
dimsiz\s*?\(\s*?([A-Za-z\w'\}]+)\s*?\)
ElementCount\( \1, \1 \)
DNLEV
-----
dnlev\s*?\(\s*?([A-Za-z\w'\}]+)\s*?\)
LevelCount\( \1, \1 \)
DFRST
-----
dfrst\s*?\(\s*?([A-Za-z\w'\}]+)\s*?\)
ElementFirst\( \1, \1 \)
DimensionDeleteAllElements
--------------------------
DimensionDeleteAllElements\s*?\(\s*?([A-Za-z\w'\}]+)\s*?\)
HierarchyDeleteAllElements\( \1, \1 \)
ATTRS and ATTRN
---------------
\battr(s|n)\s*?\(\s*?([A-Za-z\w'\}]+)\s*
ElementAttr\U\1\( \2, \2
ATTRPUTS and ATTRPUTN
---------------------
\battrput(s|n)\s*?\(\s*?([A-Za-z\w'\}]+)\s*,\s*([A-Za-z\w'\}]+)\s*
ElementAttrPut\U\1\( \2, \3, \3
ELLEV
-----
ellev\s*?\(\s*?([A-Za-z\w'\}]+)\s*
ElementLevel\( \1, \1
DIMNM
-----
dimnm\s*?\(\s*?([A-Za-z\w'\}]+)\s*
ElementName\( \1, \1
DIMIX
-----
dimix\s*?\(\s*?([A-Za-z\w'\}]+)\s*
ElementIndex\( \1, \1
DTYPE
-----
dtype\s*?\(\s*?([A-Za-z\w'\}]+)\s*
ElementType\( \1, \1
ELPAR
-----
ElPar\s*?\(\s*?([A-Za-z\w'\}]+)\s*
ElementParent\( \1, \1
ELPARN
------
ElParN\s*?\(\s*?([A-Za-z\w'\}]+)\s*
ElementParentCount\( \1, \1
ELISPAR
-------
ElIsPar\s*?\(\s*?([A-Za-z\w'\}]+)\s*
ElementIsParent\( \1, \1
ELCOMP
------
ElComp\s*?\(\s*?([A-Za-z\w'\}]+)\s*
ElementComponent\( \1, \1
ELCOMPN
-------
ElCompN\s*?\(\s*?([A-Za-z\w'\}]+)\s*
ElementComponentCount\( \1, \1
ELISCOMP
--------
ElIsComp\s*?\(\s*?([A-Za-z\w'\}]+)\s*
ElementIsComponent\( \1, \1
DIMENSIONELEMENTINSERT and DIMENSIONELEMENTINSERTDIRECT
-------------------------------------------------------
DimensionElementInsert(Direct|)\s*?\(\s*?([A-Za-z\w'\}]+)\s*
HierarchyElementInsert\1\( \2, \2
DIMENSIONELEMENTCOMPONENTADD
----------------------------
DimensionElementComponentAdd\s*?\(\s*?([A-Za-z\w'\}]+)\s*
HierarchyElementComponentAdd\( \1, \1
SUBSETGETELEMENTNAME
--------------------
\bSubsetGetElementName\s*?\(\s*?([A-Za-z\w'\}]+)\s*
HierarchySubsetGetElementName\( \1, \1
SUBSETGETSIZE
-------------
\bSubsetGetSize\s*?\(\s*?([A-Za-z\w'\}]+)\s*
HierarchySubsetGetSize\( \1, \1
SUBSETEXISTS
------------
\bSubsetExists\s*?\(\s*?([A-Za-z\w'\}]+)\s*
HierarchySubsetExists\( \1, \1
SUBSETALIASSET
--------------
\bSubsetAliasSet\s*?\(\s*?([A-Za-z\w'\}]+)\s*
HierarchySubsetAliasSet\( \1, \1
SUBSETCREATE and SUBSETDESTROY
-------------------------------
\bSubset(Create|Destroy)\s*?\(\s*?([A-Za-z\w'\}]+)\s*
HierarchySubset\1\( \2, \2
DIMENSIONELEMENTPRINCIPALNAME
-----------------------------
DimensionElementPrincipalName\s*?\(\s*?([A-Za-z\w'\}]+)\s*
HierarchyElementPrincipalName\( \1, \1
DIMENSIONSORTORDER
------------------
DimensionSortOrder\s*?\(\s*?([A-Za-z\w'\}]+)\s*
HierarchySortOrder\( \1, \1
SUBSETELEMENTINSERT and SUBSETELEMENTDELETE
-------------------------------------------
\bSubsetElement(Insert|Delete)\s*?\(\s*?([A-Za-z\w'\}]+)\s*
HierarchySubsetElement\1\( \2, \2
ATTRS and ATTRN for CUBES
-------------------------
\battr(s|n)\s*?\(\s*?'}Cubes'\s*,\s*
CubeAttr\U\1\(
ATTRS and ATTRN for DIMENSIONS
------------------------------
\battr(s|n)\s*?\(\s*?'}dimensions'\s*,\s*
DimensionAttr\U\1\(