Skip to main content
June 29, 2023

How to reset the InUse entity property to the way it was by default from a BR?

  • June 29, 2023
  • 1 reply
  • 0 views

Hello,

I have InUse for default time and scenario = True
I also have InUse for default time and scenario for 2023M5 = False.
Note that the period could also be different.

Now, how could I reset the InUse settings to disable the False or True on ALL time for default Scenario?
In my example above, I am expecting the property for 2023M5 to be deleted. 
What brapi would you use? can you show me an example?
Thanks

1 reply

June 29, 2023

It would be useful to have a screen cap of an example, for clarification on the question here.

Let's say you have an entity , where the InUse property has been set to a stored value for a certain time period:
Example:


ChrisLoran_0-1688046724680.png

Now I want to use a BR, to remove the InUse stored value , for the time period 2022M1 on the (Default) scenario type.

Dim entMbr As MemberInfo = BRApi.Finance.Members.GetMemberInfo(si,DimTypeId.Entity, "Shanghai", True)
Dim entProps As EntityVMProperties = entMbr.GetEntityProperties()
						
Dim idScenarioType As Integer = DimConstants.Unknown ' -- use for (Default) scenario type
Dim idTime         As Integer = TimeDimHelper.GetIdFromName("2022M1")
entProps.InUse.RemoveStoredPropertyItem( idScenarioType, idTime )

By running this code, it has removed the stored value (True) for the InUse property, for 2022M1 for the entity.
Only the stored value for 2020M1 now remains.


ChrisLoran_1-1688046898719.png

Now repeat the BR , with time argument of 2020M1:


ChrisLoran_2-1688046965793.png

Now all the stored values have been removed:


ChrisLoran_3-1688046997061.png

 

June 30, 2023

Hi ChrisLoran and thanks for stepping in!
What you are doing in the script is deleting one by one the properties. To achieve that, it means you already know the Time value property that needs to be deleted. How do you get a list of those time values? In your printscreen above, how would you get the list of 2020M1 and 2022M1?
and is there an api to delete all Time value  properties of the InUse?
Thanks

June 30, 2023

NicolasArgente  for time, try si.WorkflowClusterPk.TimeKey

For scenario, si.WorkflowClusterPk.ScenarioKey

In your rule:

Dim sScenario As String = ScenarioDimHelper.GetNameFromID(si, si.WorkflowClusterPk.ScenarioKey)

Dim sTime As String = BRApi.Finance.Time.GetNameFromId(si, si.WorkflowClusterPk.TimeKey)