Problem With DM Sequence Parameter Resolution Order
Good afternoon,
I'm encountering an issue and hoping someone could share how they've worked around this in the past.
We have a task that runs over a finite number of Entities. Historically the underlying Business Rule was kicked off via DM Step with Entity: E#Top.Base. It's not exactly "Top" but something similar to hopefully capture all relevant Entities to this particular task. The runtime was always a consideration as it also runs for all remaining periods within our current year.
In an effort to reduce runtime we introduced a "Unique Entity" parameter. This is defined by a Business Rule that runs and queries a source table to determine only the Entities that this particular task needs to be run on. In practice this has greatly reduced runtime on the task. Runs more than 2x faster.
The problem:
The source table that populates the list of "unique entities" is also updated within the same Data Management Sequence. Something like:
1) Update source table
2) Run task described above
Because both Steps are within the same Sequence, the "Unique Entity" business rule is being executed before #1 Update source table happens. So any changes to the source table versus a previous run could cause an Entity to be missed.
I wish the Filter would get resolved when the Step is executed instead of when the Sequence is executed.
Hopefully that makes sense to everyone? The only workaround that I'm aware of is to kick off the 2nd Step at the end of the 1st step. This removes a lot of the visibility and, as part of our current process, Step 1 is sometimes executed on its own to preview Stage data before the full Cube posting takes place.
I appreciate anyone who can provide guidance on this matter.
Thanks,
Brandon
I see, I misunderstood your initial question.
Yes, the variables / filters are resolved prior to executing the sequence i.e.: the filters for both your step 1 and step 2 are resolved initially as you are experiencing.
This means that if you want your Step1 to determine the entities that should run in your Step2 the obvious way would be, as you mention, to trigger your step 2 using the ExecuteCustomCalculateBusinessRule (so you can control the scope / list of entities it should run for).
If you want to still allow your Step1 to be ran in isolation, you could add an optional parameter (if not specified it would not trigger step2) or define a auxiliar step2 that runs for a single dummy DU (i.e.: E#None, specific period, etc) and its whole purpose would be to call the proper Step 2 logic, for the defined Entities, via the ExecuteCustomCalculateBusinessRule. This way you could keep the same 2 step sequence config while controlling the scope of your step 2 logic.
Another option would be to have your step 1 saving the list of entities in globals and configure the Step2 to run for all valid entities with an If at the very beginning to check if the api.Pov.Entity.MemberId is meant to run (i.e.: is part of the list) and immediately returning Nothing if not. Depending on the number of valid entities I'd expect this option not to be as optimal from a performance POV when compared with the options above.