01-14-2022 04:54 PM
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
01-14-2022 09:04 PM
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:
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