Skip to main content
Veteran
Oct 19, 2023 10:36 AM UTC
Solved

Use XFMemberProperty to get year from time parameter

Hi 

I'm looking to get the year from a time parameter to use in a cube view header. Is it possible to use the XFMemberProperty rule if possible?

I've tried :Name(XFMemberProperty(DimType=Time, Member=|!TimeParameter!|, Property=Year)) but the system doesn't like it.

Note, the following works to get the time description, but I'm looking to just get the year i.e. 2023

XFMemberProperty(DimType=Time, Member=|!TimeParameter!|, Property=Description)

Thanks,

Mark

Employee - Sage
Oct 19, 2023 11:36 AM UTC

Are you sure you can't do it with one of the substitution variables? |WFYear|, |PovYear|, |CVYear| ... ?

If you have to go down the scripting route (be it in XFBR or CV Extender), I'd suggest to get the year in the "proper" way, to avoid issues with funky Time Profiles:

Dim nValue As Integer = BRApi.Finance.Time.GetYearFromId(si, _
    BRApi.Finance.Members.GetMemberId(si, _
       DimType.Time.Id, "yourMemberName"))

A bit slower than string manipulation but more robust.

4 replies

Newcomer
Oct 19, 2023 10:55 AM UTC

Probably overkill but you could write a brstring rule, send your parameter to that and substring it. I mocked it up here: 

CV Column:

Thomas_Bennett_1-1697712876403.png

rule:

Thomas_Bennett_2-1697712903284.png

 

Output:

 

Thomas_Bennett_0-1697712864126.png

 

MarkBirdAuthor
Veteran
Oct 19, 2023 10:58 AM UTC

Thanks Tom, yeah I'll go down that route if there isn't an option using XFMemberProperty or some other standard function within OneStream

Employee - Sage
Oct 19, 2023 11:36 AM UTC

Are you sure you can't do it with one of the substitution variables? |WFYear|, |PovYear|, |CVYear| ... ?

If you have to go down the scripting route (be it in XFBR or CV Extender), I'd suggest to get the year in the "proper" way, to avoid issues with funky Time Profiles:

Dim nValue As Integer = BRApi.Finance.Time.GetYearFromId(si, _
    BRApi.Finance.Members.GetMemberId(si, _
       DimType.Time.Id, "yourMemberName"))

A bit slower than string manipulation but more robust.

MarkBirdAuthor
Veteran
Oct 19, 2023 1:07 PM UTC

Thank Jack, I managed to use |MFYear|