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 only run on a data unit hence 1 entity at a time. So I created a data management job dat would run on these 2 entites, and I wanted to use a Globals object along with this data buffer so that I could store data from these 2 entities into a single data buffer.

However, I'm not sure if it's the right way to do it ? Is there a way for a data buffer to take data from 2 entities ? Or, if I use a globals object with a data management sequence, is the Globals object persisting when running on 2 different entities ?

Many thanks for your anticipated feedbacks !

Regards,

  • 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.

  • FredLucas's avatar
    FredLucas
    Contributor III

    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.

  • Sergey's avatar
    Sergey
    Contributor III

    Indeed, I forgot the main point between reading values and writing back the values. It makes sense !

    Thank you Fred 🙂