06-24-2022 10:18 AM - last edited on 05-02-2023 10:10 AM by JackLacava
Hi All,
Need some help in updating properties of scenario member through an extensibility rule.
'Workflow Time
scenarioProperties.WorkflowTime.SetStoredValue(BRApi.Finance.Members.GetMemberId(si, DimType.Time.Id, objUtil.GetCycleFirstQuarter(si, api)))
'Workflow Start Time
scenarioProperties.WorkflowStartTime.SetStoredValue(BRApi.Finance.Members.GetMemberId(si, DimType.Time.Id, objUtil.GetWorkflowStartTimeForScenario(si, api)))
'Workflow End Time
scenarioProperties.WorkflowEndTime.SetStoredValue(BRApi.Finance.Members.GetMemberId(si, DimType.Time.Id, objUtil.GetWorkflowEndTimeForScenario(si, api)))
The rule compiles fine however fails on execution.
Error message received: Error updating member. Invalid parameter 'WorkflowTime'.
Would someone please guide me with the correct way to achieve this?
Solved! Go to Solution.
06-27-2022 05:46 AM
Hi Bharti
I don't think, that in this case, you can use the SetStoredValue function, you need to use the SetStoredPropertyItem function.
This sample works:
Dim scenarioMember As Member = BRApi.Finance.Members.GetMember(si, dimtypeid.Scenario, "Actual")
Dim scenarioMemberInfo As MemberInfo = BRApi.Finance.Members.GetMemberInfo(si, dimtypeid.Scenario, scenarioMember.Name, True)
Dim scenarioProperties As ScenarioVMProperties = scenarioMemberInfo.GetScenarioProperties
Dim rateHistorical As FxRateType = BRApi.Finance.Data.GetFxRateType(si, "HistoricalRate")
Dim scenarioPropertyItem As New VaryingMemberPropertyItem (cubetypeid.Unknown, scenariotypeid.Unknown, dimtypeid.Unknown, False, PropStorageType.GuidType, rateHistorical.UniqueID)
scenarioProperties.FxRateTypeForAssetLiability.SetStoredPropertyItem(scenarioPropertyItem)
brapi.Finance.MemberAdmin.SaveMemberInfo(si, scenarioMemberInfo, False, True, False, False)
I hope this helps
Can you do us a favor and answer the first question yourself? The community should become a repository of knowledge, and it needs answered questions. The more the better it will get.
06-27-2022 06:01 AM
Thanks a lot Christian, I will give this a try.
Syntax for setting workflow time, workflow start time and workflow end time is as below:
scenarioProperties.WorkflowTime.SetStoredValue(BRApi.Finance.Members.GetMemberId(si, DimType.Time.Id, objUtil.GetCycleFirstQuarter(si, api).ToString.Replace("T#","")))
scenarioProperties.WorkflowStartTime.SetStoredValue(BRApi.Finance.Members.GetMemberId(si, DimType.Time.Id, objUtil.GetWorkflowStartTimeForScenario(si, api)))
scenarioProperties.WorkflowEndTime.SetStoredValue(BRApi.Finance.Members.GetMemberId(si, DimType.Time.Id, objUtil.GetWorkflowEndTimeForScenario(si, api)))
I was just passing incorrect member name earlier which was causing the update to fail.
06-28-2022 05:24 AM
To change the default description, you need to use the
Dim myMember As WritableMember = BRApi.Finance.Members.ReadWritableMemberNoCache(si, myDimTypeId, myName)
MyMember.Description = "Hi Bharti"
06-24-2022 01:34 PM
I could get these working.
Facing issue now in updating FxRateTypeForAssetLiability property
scenarioProperties.FxRateTypeForAssetLiability.SetStoredValue(GetRateTypeID(si, api))
Issue : GetRateTypeID gives UniqueID of rate which is of type GUID.
FxRateTypeForAssetLiability.SetStoredValue() needs integer as input. I am struggling to convert this GUID to Integer.
Any leads would be appreciated.
@ChristianW @PeterFu , any thoughts please?
06-26-2022 11:04 AM
Hi Bharti
I will have a look at it tomorrow, but ratetype and fxratetype might not be the same.
Cheers
06-27-2022 05:46 AM
Hi Bharti
I don't think, that in this case, you can use the SetStoredValue function, you need to use the SetStoredPropertyItem function.
This sample works:
Dim scenarioMember As Member = BRApi.Finance.Members.GetMember(si, dimtypeid.Scenario, "Actual")
Dim scenarioMemberInfo As MemberInfo = BRApi.Finance.Members.GetMemberInfo(si, dimtypeid.Scenario, scenarioMember.Name, True)
Dim scenarioProperties As ScenarioVMProperties = scenarioMemberInfo.GetScenarioProperties
Dim rateHistorical As FxRateType = BRApi.Finance.Data.GetFxRateType(si, "HistoricalRate")
Dim scenarioPropertyItem As New VaryingMemberPropertyItem (cubetypeid.Unknown, scenariotypeid.Unknown, dimtypeid.Unknown, False, PropStorageType.GuidType, rateHistorical.UniqueID)
scenarioProperties.FxRateTypeForAssetLiability.SetStoredPropertyItem(scenarioPropertyItem)
brapi.Finance.MemberAdmin.SaveMemberInfo(si, scenarioMemberInfo, False, True, False, False)
I hope this helps
Can you do us a favor and answer the first question yourself? The community should become a repository of knowledge, and it needs answered questions. The more the better it will get.
06-27-2022 06:01 AM
Thanks a lot Christian, I will give this a try.
Syntax for setting workflow time, workflow start time and workflow end time is as below:
scenarioProperties.WorkflowTime.SetStoredValue(BRApi.Finance.Members.GetMemberId(si, DimType.Time.Id, objUtil.GetCycleFirstQuarter(si, api).ToString.Replace("T#","")))
scenarioProperties.WorkflowStartTime.SetStoredValue(BRApi.Finance.Members.GetMemberId(si, DimType.Time.Id, objUtil.GetWorkflowStartTimeForScenario(si, api)))
scenarioProperties.WorkflowEndTime.SetStoredValue(BRApi.Finance.Members.GetMemberId(si, DimType.Time.Id, objUtil.GetWorkflowEndTimeForScenario(si, api)))
I was just passing incorrect member name earlier which was causing the update to fail.
06-27-2022 08:32 AM - last edited on 04-27-2023 07:18 AM by JackLacava
How can we update default description through extender rule?
I was able to update the English US description, but don't see anything to set the default description
Dim objUtil As New OneStream.BusinessRule.Extender.EQUIP_Utility_Helper.MainClass(si)
Dim scenarioProperties As ScenarioVMProperties = objScenarioMember.GetScenarioProperties()
scenarioProperties = SetScenarioProperties(si, api, objScenarioMember)
Dim objVaryingMemberProperties As New VaryingMemberProperties
scenarioProperties = objVaryingMemberProperties.GetScenarioProperties()
Dim sNewValue As New MemberDescription
Dim memberDescriptionPk As New MemberDescriptionPk
memberDescriptionPk.Language = "en-US"
memberDescriptionPk.MemberId = objScenarioMember.Member.MemberId
memberDescriptionPk.DimTypeId = objScenarioMember.Member.DimTypeId
sNewValue.Description = // New description
sNewValue.MemberDescriptionPk = memberDescriptionPk
Dim sdctDescriptions As New Dictionary(Of String, MemberDescription)
sdctDescriptions.Add("en-US", sNewValue)
Dim sLocalValue As New MemberDescription
sLocalValue.Description = // New decsription
objScenarioMember.LocalDescription = sLocalValue
objScenarioMember.Descriptions = sdctDescriptions
'Save the member and its properties.
Using dbConnApp
dbConnApp.BeginTrans()
Dim memberPk As MemberPK = BRApi.Finance.MemberAdmin.SaveMemberInfo(si, objScenarioMember, True, True, True, False)
dbConnApp.CommitTrans()
End Using
06-27-2022 10:02 AM
I got this working. No further assistance needed on this thread.
06-28-2022 05:24 AM
To change the default description, you need to use the
Dim myMember As WritableMember = BRApi.Finance.Members.ReadWritableMemberNoCache(si, myDimTypeId, myName)
MyMember.Description = "Hi Bharti"
06-28-2022 05:30 AM
Hi Bharti
Can you please split your questions in independent requests, if the original one is solved and you have a follow up (you can link it in the original question so we can find it)?
You are doing great stuff, and your questions are really helpful for other people as well. But if you keep them together, nobody will find them (and the answers).
Thanks in advance and regards
Christian
06-28-2022 05:52 AM
Hi Christian,
Thanks for notifying this. Henceforth I will create individual posts for my queries. Thanks for all the help.