Forum Discussion

jeffvdt's avatar
jeffvdt
New Contributor III
21 days ago

Best practice for filtering vStageSourceAndTargetDataWithAttributes by Workflow

Hi everyone,

I am building a query using the vStageSourceAndTargetDataWithAttributes view and I want to ensure I am retrieving the latest figures for a specific Entity and Time period.

I have a few questions regarding the best way to filter this:

  1. Filtering by Wfk: I know that hardcoding a GUID for the Wfk (Workflow Key) is risky because it can change between environments or if a profile is reset. What is the recommended way to dynamically filter for a specific Workflow Profile? Should I be joining on the WorkflowProfileHierarchy table/view to filter by ProfileName?
  2. Latest Figures: If multiple imports have occurred, does filtering by a specific Wfk automatically ensure I am seeing the "latest" iteration of the data, or is there a better field to use for partitioning/ranking the results?

Any code snippets or best practices for making these stage queries robust would be highly appreciated.

2 Replies

  • How are you querying the data. Data Adapter using a SQL Query or Dashboard Dataset  rule / service?

  • sameburn's avatar
    sameburn
    Icon for OneStream Employee rankOneStream Employee

    One way to do this is you can get these values as substitution variables and pass them into your logic (depending on how you are calling sql). Its also good practice to parameterize strings you pass into WHERE Clause e.g.

    DECLARE @wfkID VARCHAR(100) = '|WFProfileKey|'

    Check the member filter builder, there are lots of workflow related substitution variable examples you can pass to generate sql variables based on users session / workflow they're logged into, etc