Forum Discussion

Sergey's avatar
Sergey
Contributor III
2 years ago

Globals object and Data Management steps / sequences

Dear community. I have a use case where I need to sul up data from 2 different entities and apply a ratio on it. For this, I would like to use a data buffer. However, the data buffer typically on...
  • FredLucas's avatar
    2 years ago

    Hi Sergey,

    I'm not sure I fully understand your use case but if what you want is to sum up the data from Entity A and Entity B do some math (e.g.: apply a ratio) and save it to Entity C.

    Then you could simply launch the finance rule for Entity C (target entity) and open two databuffers where you specify the Entity as part of your formula e.g:

    Dim dbEntA As DataBuffer = api.Data.GetDataBufferUsingFormula("RemoveZeros(E#A:U1#XYZ:F#None)")
    Dim dbEntB As DataBuffer = api.Data.GetDataBufferUsingFormula("RemoveZeros(E#B:U1#XYZ:F#None)")
    Dim dbEntAplusB As DataBuffer = dbEntA + dbEntB

    The "limitation" of the single data unit only applies to writing the data back to the cube as it will only allow you to write data do the Data Unit that has been set by the DM job, you can however, read data from any DU you'd like.

    As a side note, in the sample code above, the reason why summing up the two buffers would work fine is because the dimensions that define the DU (i.e.: Entity, Scenario, Time) do not form part of the content of the databuffer hence the buffers would be summed up regardless of the source Entity.