Forum Discussion

Taj's avatar
Taj
New Contributor II
3 years ago

How to get timeDim ie months in reverse starting with curr month followed by prev months? in columns

  • if I understand correctly, you need that in the cube view, right?

    In this case I'll build a quick XFBR function with the following key functionality. Please note, I oversimplify few thing there for easier read/understanding. 

    ' Say, your current period is your pov, that you are passing with Time parameter in which case
    'XFBR(XFBR_Name, ThisFunctionName,Time=|POVTime|)   <This is how you call it from the cube view
    Dim strTime As String = args.NameValuePairs.XFGetValue("Time")
    Dim intCurrentPeriod As Integer= BRApi.Finance.time.GetPeriodNumFromId(si, strTime)
    
    Dim strReturn As String = string.empty
    
    For i = 0 to intCurrentPeriod
    
    strReturn = strReturn & "T#" &  BRApi.Finance.time.GetNameFromId(si, BRApi.Finance.time.AddTimePeriods(si, i * -1,True)) & ","
    
    Next
    
    ' Get rid of the trailing comma
    
    strReturn = Left(strReturn, len(strReturn-1))
    
    Return strReturn

    There are many ways to skin this cat, thought, including loop with step -1 etc.

  • Taj's avatar
    Taj
    New Contributor II

    Hi. Thanks a lot for your time /suggesstion. I will check this out... 

  • BrittaniaH's avatar
    BrittaniaH
    New Contributor II

    Hi All, I am trying to do this using T#WFYear.Base.  Is there a way to reverse the order of months from 1st month to last month in report?