The OneStream Community is temporarily frozen until June 29th due to the ongoing maintenance. Please read the blog post here to learn more.
Forum Discussion
WernerN
1 year agoContributor II
Create Scenario Member from Rule
Dear Community Members,
Found several great posts about creating account members from a rule. I am trying to clone a scenario member (Forecast with Range defined).
I have to admit that i am running into a knowledge gap when it comes to how to create some of the properties.
I am reading the properties of my source scenario and naively thought i can just use SetStoredValue with the property of the source scenario. Got stuck at InputFrequency.
Any pointers to documentation, Golfstream, Community posts, or samples would be greatly appreciated.
2 Replies
- victorteiNew Contributor III
WernerN,
Does your code already create the member and the only issue is with the properties? If the issue is with properties, then which property?
Keep in mind that creating a member requires two main steps:
- Create the member
- Add Relationship
For the first step, if you don't have the code, here's something you can try. Of course, you'll need to create the variables I'm using in this code, but you get the idea of how to do so:
'Update Dim Name accordingly Dim objDim As OneStream.Shared.Wcf.Dim = BRApi.Finance.Dim.GetDim(si, DimensionName) 'Create New Member Dim objMember As New Member(objMemberPk, ChildName, ChildDesc, objDim.DimPk.DimId) 'Create VaryingMemberProperties object Dim objProperties As New VaryingMemberProperties(objMemberPk.DimTypeId, objMemberPk.MemberId, DimConstants.Unknown) 'Create new member info object for new member Dim objMemberInfo As New MemberInfo(objMember, objProperties, Nothing, objDim, DimConstants.Unknown) 'Modify some member properties. Dim newmemberProperties As ScenarioVMProperties = objMemberInfo.GetScenarioProperties() 'Save the member and its properties. Dim isNew As TriStateBool = TriStateBool.TrueValue BRApi.Finance.MemberAdmin.SaveMemberInfo(si, objMemberInfo, True, True, False, isNew)Please, note that one thing that will vary depending on the dimension you're creating the member is this line mainly:
Dim newmemberProperties As ScenarioVMProperties = objMemberInfo.GetScenarioProperties()Then, to accomplish Step 2, as I mentioned above, here's another sample code to create the relationship:
Dim NewMemberInfo As MemberInfo = BRApi.Finance.Metadata.GetMember(si, DimTypeIdName, ChildName) Dim NewMemberId As Integer = NewMemberInfo.Member.MemberId Dim relPk As New RelationshipPk(DimTypeIdName, ParentMemberId, NewMemberId) Dim rel As New Relationship(relPk, DimID, RelationshipMovementType.InsertAsLastSibling, 1) Dim relInfo As New RelationshipInfo(rel, Nothing) Dim relPostionOpt As New RelationshipPositionOptions() ' Move the member to the parent BRApi.Finance.MemberAdmin.SaveRelationshipInfo(si, relInfo, relPostionOpt)Hope this helps!
- SweezContributor
I am curious if anyone has had success creating a scenario member, and updating default properties, from a single DM job? I am having an issue becuase it seems, by default, the "Manage Data Group" security is set to None after creating the member and thus I can not update properties until I manually change the security group for this property. This might just be a limitation due to what the security setting is used for but thought I would ask.
Related Content
- 7 months ago