Monday, May 1, 2023

Smart list Value > Member Name

 

How to read a member name in a calcmgr rule from smart list value

Smart Lists
Service Administrators use Smart Lists to create custom drop-down lists that users access from form cells. When clicking in cells whose members are associated with a Smart List (as a member property), users select items from drop-down lists instead of entering data. Users can't type in cells that contain Smart Lists. Smart Lists display in cells as down arrows that expand when users click into the cells.

Smart lists will enhance the user interface and control while setting the assumptions and inputs that drives the further processing.

We all know that
In Calculation Manager, you can insert a Smart List into a variable or into formula, script, condition, and member range components.

Problem Statement


If you look at the above form, it is “add new asset” forms, part of capex model. New assets are introduced at different months. We should calculate the asset schedule from the period of the asset acquisition. That involves the calculation of Gross Asset, Depreciation, Accumulated Depreciation, Net Asset Value. Here we focus only on Depreciation Calculation as the purpose is to understand the member lookup from the smart list

For a given asset, “New_Asset_001”, I wanted to calculate the depreciation from May onwards, for the “New_Asset_002”, from Jan onwards, This should happen based on the form selections, and dynamic.
Code should not be required cycle through all twelve periods for each asset to figureout the asset start period.

Solution Part:

From the different sources I learned We could reverse engineer a member name from the smart list value as below:

@MEMBER(@CONCATENATE("HSP_ID_", @hspnumtostring("AssetStartPeriod"->"BegBalance")))

Okay!!!

Can I use this function in FIX/ENDFIX to get the list of periods from the asset form. Let’s try this

FIX(@MEMBER(@CONCATENATE("HSP_ID_", @hspnumtostring("AssetStartPeriod"->"BegBalance"))):"Dec")


No, it’s not working. Let’s try the same using if/endif.

if (@ISMBR(@MEMBER(@CONCATENATE("HSP_ID_", @hspnumtostring("AssetStartPeriod"->"BegBalance"))) : "Dec"))


Hmmm. This got validated! 
Let me execute and see if it works as expected.


Results are good. 


Let me modify the start periods and run







 


Looks alright!

How this works? We should know how system read it. Let me try with a return function to know how system read.

@return(@CONCATENATE("HSP_ID_", @hspnumtostring("AssetStartPeriod"->"BegBalance")),error);


  Cannot calculate. Essbase Error(0): HSP_ID_2155886880967624

  Can this “HSP_ID_2155886880967624 be an alias hidden inside and  represent the period "Feb".




If I supply this string into @member function, what it reads.





Here you go – It is Feb

Note:

It works only if smart list is created from members.








And see to that code return a proper value always. Any #MISSING or Invalid Numeric ID will not work. Let me comment the if ("AssetStartPeriod"->"BegBalance" <> #MISSING) so that system process other assets also with missing data



Here it tried to process "New_Asset_002" also, and failed as it returned invalid period in the smart list lookup
Let me revert the changes.


It worked here as it didn't process "New_Asset_002" as the condition if ("AssetStartPeriod"->"BegBalance" <> #MISSING) filtered the "New_Asset_002". 

Hope this helps. Thanks. 

 

No comments:

Post a Comment