How to change an entity member description defaut and other cultures from a BR?

NicolasArgente
Valued Contributor

Hello,

I am using 2 cultures on a server.
I need to make some changes of entity properties from a BR.
I know how to do it for properties like ALLLOWADJ
I can not find a way to change all the descriptions from the BR : I mean the Default + English + French.
Any help appreciated.
Thanks
PS: I did read that 🙂 https://community.onestreamsoftware.com/t5/Rules/Update-description-of-a-member-in-an-Extender-rule-...

Connect with me on:
LinkedIn: https://www.linkedin.com/in/nicolas-argente/
Website: https://aiqos.io
If you want to lift yourself up, lift up someone else.
3 REPLIES 3

ChristianW
Valued Contributor

Hi Nicolas

This is an extract from one of my projects, the snippet shows how to change the languages for a member. It is untested, but it the concept should work:

 

Dim languageName As String = "en-US"
Dim oDimpk As DimPk = BRApi.Finance.Dim.GetDimPk(si, "Your dimension")
Dim oMemberToUpdate As MemberInfo = BRApi.Finance.Metadata.GetMember(si, oDimpk.DimTypeId, "Name of your member", True,, New MemberDisplayOptions(True, CultureInfo.CurrentCulture.Name, True,True,True, True, True, False))
Dim newDescription As String = "Hello World"
Dim testCulture As MemberDescription = Nothing

If oMemberToUpdate.Descriptions.TryGetValue(languageName, testCulture) Then
	testCulture.Description = newDescription
Else
	Dim testCulturePk As New MemberDescriptionPk(oDimpk.DimTypeId, oMemberToUpdate.Member.MemberId, languageName)
	testCulture = New MemberDescription(testCulturePk, newDescription)
	oMemberToUpdate.Descriptions.Add(languageName, testCulture)
End If
brapi.Finance.MemberAdmin.SaveMemberInfo(si, oMemberToUpdate, False, False, True, TriStateBool.FalseValue)

 

Cheers

Christian

ChristianW
Valued Contributor

And this is the code snippet for description, you need to use the WritableMember object:

Dim oDimpk As DimPk = BRApi.Finance.Dim.GetDimPk(si, "Your dimension")
Dim newDescription As String = "Hello World"
Dim oMember As WritableMember = BRApi.Finance.Members.ReadWritableMemberNoCache(si, oDimpk.DimTypeId, "Name of your member")								
Dim oMemberToUpdate As MemberInfo = BRApi.Finance.Metadata.GetMember(si, oDimpk.DimTypeId, "Name of your member", True,, New MemberDisplayOptions(True, True, True,True,True, True, True, False))

oMember.Description = newDescription
Dim lstDesc As List(Of MemberDescription) = Nothing
brapi.Finance.MemberAdmin.SaveMemberInfo(si, True, oMember, False, Nothing, False, lstDesc, TriStateBool.FalseValue)

 

Thank you @ChristianW ! I will test that this week. 

Connect with me on:
LinkedIn: https://www.linkedin.com/in/nicolas-argente/
Website: https://aiqos.io
If you want to lift yourself up, lift up someone else.
Please sign in! NicolasArgente