Forum Discussion

MarcusH's avatar
MarcusH
Valued Contributor
2 years ago
Solved

Get member description in user's culture code

Does anyone know how to get the member description in the user's culture code?

  • ok, you can access the descriptions with the memberinfo object:

     

    Dim MemberIdOfAccount As Integer = BRApi.Finance.Members.GetMemberId(si, DimTypeId.Account, "41010")
    Dim test As MemberInfo = BRApi.Finance.Members.GetMemberInfo(si, DimTypeId.Account, MemberIdOfAccount,,,New MemberDisplayOptions(True,"en-US",True,False,False,False,False,0))
    
    BRApi.ErrorLog.LogMessage(si, test.Descriptions("en-US").Description & " " & test.Descriptions("fr-FR").Description)

     

19 Replies

  • JackLacava's avatar
    JackLacava
    Icon for OneStream Employee rankOneStream Employee

    BRApi.Finance.Members.ReadMemberDescriptionsNoCache(si, dimTypeId, memberId) should give you all the descriptions, then you can loop through them. Each MemberDescription has a MemberDescriptionPK with a property for the language, i think.

    • MarcusH's avatar
      MarcusH
      Valued Contributor

      ReadMemberDescriptionNoCache returns the list of aliases for the member (I've just tested it). If the member does not have an alias for a particular language it does not return anything. MemberDisplayOptions on the other hand returns the alias if it exists and the default value if there is no alias for the member which is what I want. Thank you for your time Jack. I will keep this in my little Rules bank.

      • ChristianW's avatar
        ChristianW
        Icon for OneStream Employee rankOneStream Employee

        Markus, you can use Jack's suggestion as well, I tested it and added a sample.

    • ChristianW's avatar
      ChristianW
      Icon for OneStream Employee rankOneStream Employee
      Dim MemberIdOfAccount As Integer = BRApi.Finance.Members.GetMemberId(si, DimTypeId.Account, "41010")
      Dim list As List(Of MemberDescription) = BRApi.Finance.Members.ReadMemberDescriptionsNoCache(si, dimTypeId.Account, MemberIdOfAccount)
      Dim englisch As String = list.FirstOrDefault(Function(x) x.MemberDescriptionPk.Language = "en-US").Description
      Dim french As String = list.FirstOrDefault(Function(x) x.MemberDescriptionPk.Language = "fr-FR").Description
      BRApi.ErrorLog.LogMessage(si, englisch & " " & french)
      • WernerN's avatar
        WernerN
        Contributor II

        Thanks again for these posts.  I got the list function to work perfectly.

        Do we also have a function that can write to MemberDescription? 
        I am researching the possibility of a 'translation function' to take in English, translate (with Google API, and write back to German Description (or any other language.

  • ChristianW's avatar
    ChristianW
    Icon for OneStream Employee rankOneStream Employee

    ok, you can access the descriptions with the memberinfo object:

     

    Dim MemberIdOfAccount As Integer = BRApi.Finance.Members.GetMemberId(si, DimTypeId.Account, "41010")
    Dim test As MemberInfo = BRApi.Finance.Members.GetMemberInfo(si, DimTypeId.Account, MemberIdOfAccount,,,New MemberDisplayOptions(True,"en-US",True,False,False,False,False,0))
    
    BRApi.ErrorLog.LogMessage(si, test.Descriptions("en-US").Description & " " & test.Descriptions("fr-FR").Description)

     

    • XaviC's avatar
      XaviC
      New Contributor III

      Does it work to get the FX Rates description? I have tried without success.

      Thanks

  • ChristianW's avatar
    ChristianW
    Icon for OneStream Employee rankOneStream Employee

    Hi Markus

    Do you need to know, how to load it? Or how to access it?

    Cheers

    Christian

    • WernerN's avatar
      WernerN
      Contributor II

      Christian, I would love to learn how to load local descriptions.  With all the posts on this thread I am totally able to access and now to translate.
      Thanks/Danke/Merci/Gracias/Grazie 

    • MarcusH's avatar
      MarcusH
      Valued Contributor

      How to access it. I am processing base members for Confirmation Rules and I want to show the user the member description in their language if it fails the Rule. I am currently using this to get the member list

      Dim AllBase As List(Of Member) = api.Members.GetBaseMembers(BRApi.Finance.Dim.GetDimPk(si, UD6DimensionName), topUD6MemberID)