Forum Discussion

BryanMulder's avatar
BryanMulder
New Contributor II
4 years ago

Systematic Global Time Update

Hi All,

We would like to draw up some dynamic QV's from a time perspective & always have them aware of the current time so we can utilize the T#PeriodPrior1() MF rule. I'm curious how others have made these dynamically change, we were considering a BR to update the 'Global Time' on a systematic basis and then we could direct users to use this global time & know that it is always reflective of the current week. Maybe I'm overlooking some function of OS to do this but it seems like there isn't a natural dynamic time option.

Thanks,

Bryan

 

1 Reply

  • db_pdx's avatar
    db_pdx
    Valued Contributor

    Hi Bryan: I'm not aware of an out-of-the-box dynamic time.  You could definitely create a BR to update the Global Time.  We have something similar to what you are suggesting for an automated month-end close period, but we are not updating the Global Time as we have overlapping Close/Forecast activities going on at the same time, rather a simple BR does the trick.  It works as follows:

    • Cube Views that have a parameter in the fixed POV (for example |!Select_Time_Close!|)
    • This parameter is a member list containing 3 years of possible selections (T#2022.Base, T#2021.Base, T#2020.Base)
    • Key!  This parameter has a default value that is a business rule which determines the correct month-end close period
      • Default Value: BRString(XFBR_ParamHelper, MonthEndClosePeriod)
    • The associated Business Rule does some simple math based on the current time to set the month-end period
      • Relevant code from the Dashboard XFBR String below:
     If args.FunctionName.XFEqualsIgnoreCase("MonthEndClosePeriod") Then

    ' Get current year and month based on ~right now~
    Dim nYear = DateTime.Now.Year
    Dim nMonth = DateTime.Now.Month
    Dim sYear As String
    Dim sMonth As String
    Dim sPeriod As String

    'If month is January, give the prior year, else the current year
    If (nMonth = 1) Then
    sYear = (nYear - 1).ToString
    Else
    sYear = nYear.ToString
    End If
    'If month is January, give 12, else the current month - 1
    If (nMonth = 1) Then
    sMonth = "12"
    Else
    sMonth = (nMonth - 1).ToString
    End If

    ' Mash them up with "M"
    sPeriod = sYear & "M" & sMonth
    Return sPeriod
    End If

     This way, the default Cube View will display the period just closed but also allow users to select a different period if they so choose.

    In your case, you'll need to modify the BR to pull in the current week of the year  .  As well, you mention wanting to be able to have the cube view contain some references to this dynamic value.  For this use the standard time functions while referencing the fixed Cube View Point of View |CVTime| (example: T#PeriodPrior1(|CVTime|).

    Hope this helps.  Cheers!

    -DB