Forum Discussion

Marco's avatar
Marco
Contributor II
2 months ago

How can I assign a new value to an entity that is not the POV of my Data Management?

Hi Everyone.

I would like to know how I can perform a setdatacell on an entity that is not in my Data Management configuration. I obtain the value of the entity from Text 1 of my entity assigned to the POV, but it does not allow me to apply a setdatacell or a calculate to assign a new value to that entity. Therefore, I would like to know how I can achieve this.

My Data management configuration:

The example code I am using:

Dim strEntity As String = api.Pov.Entity.Name
Dim strScenario As String = api.Pov.Scenario.Name
Dim strTime As String = api.Pov.Time.Name
Dim povEntityId As Integer = api.Pov.Entity.MemberId
Dim strEntTx1 As String = api.Entity.Text(povEntityId, 1)

'setdatacell
api.Data.SetDataCell("S#[" & strScenario & "]:T#" & strTime & ":E#" & strEntTx1 & ":A#S_ConvFactorInner:O#BeforeAdj:U1#D0000:U2#P0000:U3#LOCAL_DATA:U4#PJ00000:U5#None:U6#None:U7#None:U8#None",totAll,False,True)

'Data.Calculate
api.Data.Calculate("Cb#HLFPLN:S#[" & strScenario & "]:T#" & strTime & ":E#" & strEntTx1 & ":A#S_ConvFactorInner:V#Periodic:C#Local:F#None:O#BeforeAdj:I#None:U1#D0000:U2#P0000:U3#LOCAL_DATA:U4#PJ00000:U5#None:U6#None:U7#None:U8#None = (" & totAll.ToString & ")",True)

 

 

  • MarcusH's avatar
    MarcusH
    Contributor III

    You can read from any Entity but you can only update the current Entity. You would have to loop round all the Entities that might be updated via the Text1 property, query the Entities that have the Text1 property (eg 30801_30800) and compare the Text1 property to the current Entity. If that is not practical then you might need to consider another way of doing it (XFSetValue in a Spreadsheet perhaps but that data is not flagged as calculated which might cause a problem). If this is a single value you might consider using an intercompany account in a central Entity. You calculate the central Entity first and that pulls the value into the IC account where the IC member is the source Entity. Then calculate the other Entities and they look up their value from the IC account in the central Entity.

  • Marco's avatar
    Marco
    Contributor II

    Hi Marcus.

    Thank you very much for responding. Regarding the method of using an IC, it is something I cannot do due to security restrictions. For now, I was using a second Data Management, but I encountered the same problem of getting the restrictions on where I want to put the information and that what is now in the entity is Text1. So now I need to know which specific entity was executed in the first step to obtain the value I need to assign to the entity in Text1.