Forum Discussion

alexandraMiz's avatar
alexandraMiz
New Contributor
6 months ago

BI Viewer Time sorting with custom Time Profile

I am trying to build a stacked bar chart with time on the x-axis. Time is being chosen via a parameter in the cubeview and then populating the 12 months prior to the time chosen as well as the time chosen. The time profile being used a custom profile with M1 being April. When I enable "Add Start End Calendar Time" in the data adapter and use "StartTime" as my argument, the data comes through for the right months, however the descriptions for time are that of a standard time profile (i.e. M1 is January) even though it is pulling April data. When I disable "Add Start End Calendar Time" in the data adapter and use "Time" as my argument, I get the correct time descriptions for the custom time profile, but they are out of order (displaying in alphabetical/numerical order).  Does anyone know a way around this? 

  • KarlT's avatar
    KarlT
    Contributor III

    I've noticed this in the past, although surprised you are seeing the correct start dates as I've always found them both to be based on the "Standard" time profile (the same seems to be true when you use "api.Pov.Time.TimeMemberDetail.StartDate" in a dynamic calc as well).

    My solution was to just create a "calculated" field in the BI Viewer that did an offset to the times being brought in, then using this in my report.

    As Fred says, worth raising with Support though.

  • FredLucas's avatar
    FredLucas
    Contributor III

    Hi alexandraMiz,

    What you just described sounds like a bug to me so I'd make sure to let support know about it via a ticket.

    It could even be that it's already a known issue and if lucky, already fixed in a later version (not sure what version you are on).

    As for workarounds, what you could do is to write a data set business rule that triggers the FdxExecuteCubeView function (which returns a data table object) and use vb.net to apply any changes to description etc you need to the table.

    You'd then call this dataset rule from the Data adapter and feed that to BI Viewer.

    Hope that helps.

    • aformenti's avatar
      aformenti
      Contributor II

      Hi alexandraMiz ,

      See an example of the work-around tat FredLucas  is proposing below:

      		'{GetDataSet}{DataSetName}{ScenarioTypeName=[Actual],Time=[|WFTime|]}
      		Public Function GetCubeViewMDData(ByVal si As SessionInfo, ByVal args As DashboardDataSetArgs, ByVal DataAdapterName As String) As DataTable
      			Try
      				'Gets data from the Cube View MD Data Adapter:
      				Dim objDataSet As DataSet = BRApi.Dashboards.Process.GetAdoDataSetForAdapter(si, False, DataAdapterName, "CubeViewMD", args.CustomSubstVars)
      				Dim dt As DataTable = objDataSet.Tables(0).Copy()
      				
      				'Get args:
      				Dim ScenarioTypeName As String = args.NameValuePairs.XFGetValue("ScenarioTypeName",String.Empty)
      				Dim Time As String = args.NameValuePairs.XFGetValue("Time",String.Empty)
      				Dim ScenarioTypeId As Integer = ScenarioType.GetItem(ScenarioTypeName).Id
      				Dim TimeId As Integer = BRApi.Finance.Members.GetMemberId(si, dimtypeid.Time,Time)
      				
      				'Loops through Table and pulls Text3 
      				If (Not dt Is Nothing)
      					For Each srow As DataRow In dt.Rows
      						'Pull the Account Name (Should be pointed to the right Account Field Name ("Account"):
      						Dim AccountName As String = srow("Account").item
      						Dim AccountId As Integer = BRApi.Finance.Members.GetMemberId(si,dimtypeid.Account,AccountName)
      						Dim AccountText As String = BRApi.Finance.Account.Text(si,AccountId,3,ScenarioTypeId,TimeId)
      						'Repoints the Account Field for Text Property:
      						srow("Account") = AccountText
      					Next sRow
      					Return dt
      				End If 
      				
      				Return Nothing
      			
      		Catch ex As Exception
      			Throw ErrorHandler.LogWrite(si, New XFException(si, ex))
      		End Try
      	End Function