imaslyanchuk
30 days agoNew Contributor II
Dynamic Scenario in Cube View columns based on selection
I know I can have a different scenario where I can combine actuals and forecast each month with data management job and I can use AllPriorYInearInclusive for Actual columns and AllNextInYearInclusive...
- 13 days ago
Got below code to do what I pretty much needed to do. Found it here in another thread. Still need to tweak it a bit since I dont need it to loop through the list but this code works.
Scenario: xfbr(MyCustomXFBR2, PastCurrActualFutForecast, CurTime=|!GeneralTime!|, ColTimeQuery=[T#|CVYear|M1])
Time: T#|CVYear|M1
Try Select Case args.FunctionName Case Is = "PastCurrActualFutForecast" Dim curTime = args.NameValuePairs.XFGetValue("CurTime") Dim curTimeMember As Member = BRApi.Finance.Members.GetMember(si, DimTypeId.Time, curTime) Dim colTimeQuery = args.NameValuePairs.XFGetValue("ColTimeQuery") Dim colTimeMemberList As list (Of MemberInfo) = BRApi.Finance.Members.GetMembersUsingFilter(si, brapi.Finance.Dim.GetDimPk(si, "Time"), colTimeQuery,False) Dim povs As New List(Of String) For Each colTimeMember As MemberInfo In colTimeMemberList If curTimeMember.MemberId >= colTimeMember.Member.MemberId povs.Add($"S#Actual")':T#{colTimeMember.member.Name}") Else povs.Add($"S#Forecast")':T#{colTimeMember.member.Name}") End If Next Return String.Join(",", povs) End Select Return Nothing Catch ex As Exception Throw ErrorHandler.LogWrite(si, New XFException(si, ex)) End Try