Forum Discussion

AlvaroSR's avatar
AlvaroSR
New Contributor II
7 months ago

Get WFScenario in Complex Expression Time Data Source

I am trying out a complex expression in Time Data Source. The issue is the next:

I have a Forecast scenario type with input frequency monthly and on the other hand I have a Long Term scenario type with input frequency yearly. Therefore, the colum time in the file is yearly, so I developed a complex expression where I can load depending on neither scenario type year 2024 or WFTime (forecast for this case) or scenario type year 2024 + M12 or WFTime + M12 (Long Term for this case).

This is my complex expression (that is not working):

Dim vYear As String = args.Value
Dim scenId As Integer=api.CurrentDataClusterKey.ScenarioID
Dim scenType As ScenarioType = BRApi.Finance.Scenario.GetScenarioType(si,scenId)

If scenType=ScenarioType.Forecast Then
Return vYear + "M12"
Else
Return vYear
End If

I appreciate all your comments,

Thank you.

  • Finally, I solved with the next script:

    Dim vYear As String = args.Value
    ''Dim scenId As Integer = api.ScenarioTypeID
    Dim scenId As Integer=api.CurrentDataClusterKey.ScenarioID
    Dim scenType As ScenarioType = BRApi.Finance.Scenario.GetScenarioType(si,scenId)
    ''brapi.ErrorLog.LogMessage(si,sValue)
    If (scenType.ToString = "LongTerm") Then
    Return vYear
    Else
    Return vYear + "M12"
    End If

     

    Maybe someone has the same issue,

    Thanks.

  • AlvaroSR's avatar
    AlvaroSR
    New Contributor II

    Finally, I solved with the next script:

    Dim vYear As String = args.Value
    ''Dim scenId As Integer = api.ScenarioTypeID
    Dim scenId As Integer=api.CurrentDataClusterKey.ScenarioID
    Dim scenType As ScenarioType = BRApi.Finance.Scenario.GetScenarioType(si,scenId)
    ''brapi.ErrorLog.LogMessage(si,sValue)
    If (scenType.ToString = "LongTerm") Then
    Return vYear
    Else
    Return vYear + "M12"
    End If

     

    Maybe someone has the same issue,

    Thanks.