Forum Discussion

jzachar's avatar
jzachar
New Contributor III
3 months ago

Finance Business Rule Data.Calculate format

I'm struggling to understand how exactly to calculate what I need, a confirmation of direction and a little guidance would be great!  I need to calculate an account value (Factored account)  from a D...
  • TheJonG's avatar
    3 months ago

    Both suggestions by rhankey and akatsman are good - either an Eval or a Data Buffer cell loop give you ultimate flexibility, however, they are fairly advanced techniques that can be hard to get your head around at first. My suggestion is to use the unbalanced function within an api.Data.Calculate as already mentioned. Here is how you would implement it given your example, assuming the Driver detail has detail for 3 UDs (product, region, customer).

    api.Data.Calculate("A#Factor = MultiplyUnbalanced(A#Driver, A#Percent:U1#None:U2#None:U3#None, U1#None:U2#None:U3#None")

     

    The result of this will produce the Factor account at the same level of detail as the driver (ud1, ud2, ud3). The Unbalanced function essentially 'fixes' the dimensions to None for the Percent buffer and multiplies the same percent against all cells of the Driver buffer. You can add multiple unbalanced functions together once you get the simple example working. Hope this helps.