Subsets In Rules
Posted: Thu Sep 24, 2020 7:01 pm
I recently was playing around with some of the new (and by "new" I mean "new to me") TM1 rule functions, and stumbled across something that may be interesting to others. Thank you PavoGa for your help in testing and validating this thing!
For a while, we've known about the ability to use subsets in place of elements in a CellGetS/CellGetN functions, which makes sense since you can actually copy the subset name as text and paste it as a consolidation in the Architect dimension editor - nothing new here. While this works great for some cases in TIs, the DB calls in rules never quite had this functionality. For example:
With the addition of CellValueS and CellValueN however, we now have the ability to grab data out of cubes (right hand side of rule) through subset addressing. For example:
Please note, the Cycle and Measure references could actually be chopped off for a cleaner statement. It's entirely possible this is nothing new to anyone, but I found it interesting and thought it was worth documenting on the forums.
NOTE: This WILL work for dynamic subsets, but the performance could take a huge hit. Use at your own risk - this may be a perfect solution for some easy dynamic or static subsets, but I would guess that this would have a huge negative impact on performance for some more complicated dynamic subsets.
For a while, we've known about the ability to use subsets in place of elements in a CellGetS/CellGetN functions, which makes sense since you can actually copy the subset name as text and paste it as a consolidation in the Architect dimension editor - nothing new here. While this works great for some cases in TIs, the DB calls in rules never quite had this functionality. For example:
Code: Select all
CellGetN('cubeName', vCycle, 'SubsetNameAsElement', vMeasure) <-- This will work
DB('cubeName', !Cycle, 'SubsetNameAsElement', !Measure) <-- This will fail
Code: Select all
CellValueN('cubeName', 'Cycle':!Cycle, 'Dimension':'SubsetNameAsElement', 'Measure':!Measure) <-- This will work!!!
NOTE: This WILL work for dynamic subsets, but the performance could take a huge hit. Use at your own risk - this may be a perfect solution for some easy dynamic or static subsets, but I would guess that this would have a huge negative impact on performance for some more complicated dynamic subsets.