Forum Discussion

CarlosAlvear's avatar
CarlosAlvear
Contributor
10 days ago
Solved

Change View POV inside Custom Calculate BR

Dear all,

 

We have 2 custom calculate functions (Finance BR) that are executed one after the other. The 1st one uses V#Period as POV and the 2nd uses V#YTD as View POV. These POV are set on the data management steps that use these functions.

We'd like to merge both functions into one to simplify maintenance but the fact that they use different View POV creates an issue; if the data management steps uses V#Periodic or V#YTD, one function will work properly but not the other. Do you know how it can be set as a fixed View POV into the functions itself? Maybe there's a way updating the value of the "args" variable that is used as an input into the formula.

Thank you for the help and guidance.

Best regards,

Carlos

 

  • markolainio's avatar
    markolainio
    6 days ago

    You can define the view by using ExpressionDestinationInfo like this:

    Dim destination As ExpressionDestinationInfo = api.Data.GetExpressionDestinationInfo("V#YTD")

    api.Data.SetDataBuffer(result_buffer, destination)

  • Thank you Robb.

    In case of an api.data.calculate that makes sense, but how to manage in case of calculating using a data buffer? Because the output data buffer will take the view from the POV. Is there a way to change it hardcoded?

    Thank you 

    • markolainio's avatar
      markolainio
      New Contributor II

      You can define the view by using ExpressionDestinationInfo like this:

      Dim destination As ExpressionDestinationInfo = api.Data.GetExpressionDestinationInfo("V#YTD")

      api.Data.SetDataBuffer(result_buffer, destination)

  • RobbSalzmann's avatar
    RobbSalzmann
    Valued Contributor II

    If you're sure your calcs will always use V#Period, then V#YTD, consider just hard-coding the values and be done with it.  Simple is often better.

    Post your code if you need a little help making it work like this.