mroscelli
4 years agoNew Contributor III
Retrieving text attribute value for any member via XFBR
Hi, I would like to retrieve the value for a text attribute of a member - could be in any any dimension - in order to display it in a label on a dashboard.
Can I do so with a generic XFBR?
- 4 years ago
This is an example of XFBR code that can retrieve any text attribute, as well as member description, from any member in any dimension. It will also work when retrieving scenario/time varying attributes.
XFBR(PRJ_ParamHelper, GetAttribute, Dimension=YourDimension, Member=YourMember, Attribute=Text2, Scenario=YourScenario, Time=YourTime)
the Attribute parameter can be any text attribute (Text1...Text12), or you can use Description to retrieve the description
The Scenario and Time parameters are optional.
If args.FunctionName.XFEqualsIgnoreCase("GetAttribute") Then ' Attribute can be Description or a Text Attribute (Text1, Text2,...) Dim strDim = args.NameValuePairs.XFGetValue("Dimension",String.Empty) Dim strMember = args.NameValuePairs.XFGetValue("Member",String.Empty) Dim strAttr = args.NameValuePairs.XFGetValue("Attribute",String.Empty) Dim strScenario = args.NameValuePairs.XFGetValue("Scenario",String.Empty) Dim strTime = args.NameValuePairs.XFGetValue("Time",String.Empty) ' If looking for specific scenario/time, set the IDs Dim intTimeId As Integer = DimConstants.Unknown Dim intScenarioId As Integer = DimConstants.Unknown If strScenario <> String.Empty Then intScenarioId = BRApi.Finance.Members.GetMember(si,DimTypeId.Scenario,strScenario).MemberId If strTime <> String.Empty Then intTimeId = BRApi.Finance.Members.GetMember(si,DimTypeId.Time,strTime).MemberId ' Get the attribute value. Dim dimPk As DimPk = BRApi.Finance.Dim.GetDim(si,strDim).DimPk If strAttr = "Description" Then Return brapi.Finance.Members.GetMember(si, dimPk.DimTypeId,strMember).Description Dim writMemProps As VaryingMemberProperties = brapi.Finance.Members.ReadMemberPropertiesNoCache(si, dimPk.DimTypeId, strMember) Dim attrId As UDMemberPropTypeId = [Enum].Parse(GetType(UDMemberPropTypeId),strAttr) Return writMemProps.InternalProperties(attrId).GetStoredPropertyItem(DimConstants.Unknown,intScenarioId,intTimeId).TextValue End If