Member Formula - get current member name

MarcusH
Contributor III

Hi All

Does anyone know if you can get the current member name in a Member Formula? As an example, I have the UD8 member UD8 AverageRate_Budget - I want that information without manually adding a variable. I have a lot of members whose member names contain all the information for their value. It would save me a lot of time if I had one script that I could copy to all the members without editing them to update the member name. The members are DynamicCalc if that makes a difference.

I have tried args.DataCellArgs.FunctionName and args.CustomCalculateArgs.FunctionName but they both raise an error.

Thanks

Marcus

1 ACCEPTED SOLUTION

TheJonG
Contributor II

If I am understanding you correctly, you have a formula e.g. api.Data.Calculate("A#Sales = A#Price * A#Volume") and would like this to know if you can do something like this: api.Data.Calculate("A#[Current Member Name] = A#Price * A#Volume") assuming so that you can copy this formula to other members and not have to update the target name?

If so, I don't believe there is a way to do this. The finance engine processes scripts without knowledge of member names for which they are attached. If you can describe exactly what your formula is and what its trying to do, there may be a way to write the formula differently in a business rule which loops through a data buffer and brings in the account name so logic can be performed on it. 

View solution in original post

4 REPLIES 4

TheJonG
Contributor II

If I am understanding you correctly, you have a formula e.g. api.Data.Calculate("A#Sales = A#Price * A#Volume") and would like this to know if you can do something like this: api.Data.Calculate("A#[Current Member Name] = A#Price * A#Volume") assuming so that you can copy this formula to other members and not have to update the target name?

If so, I don't believe there is a way to do this. The finance engine processes scripts without knowledge of member names for which they are attached. If you can describe exactly what your formula is and what its trying to do, there may be a way to write the formula differently in a business rule which loops through a data buffer and brings in the account name so logic can be performed on it. 

The formulas are not returning amounts, it's text which is stored in the Account Text property and it needs to be parsed (it's for ESG and CbC reporting). You have answered my question anyway. I can make the member formulas dynamic by dimension but not by all dimensions. Not a big problem as the members will probably be always in the same dimension anyway.

YanSavinsky
New Contributor III

Will not the following do the job?

Dim UD8Name As String = api.Pov.UD8.Name.ToString

 

Yes it does work but that is hard coding UD8. The whole point is to get the member to which the member formula is attached so the BR can work out if it needs to get UD8 or UD7 or UD6 etc.