Filter datacell on UD dimension
Hi,
I have an existing extensibility rule which copy some data from a source scenario/period to a target scenario/period.
This is the "core" of the code
Dim listDriversDataCellExFilterdForDriversTarget As New List(Of DatacellEx)
For Each itemDataCellEx As DataCellEx In listDriversDataCellExFilterdForDrivers
itemDataCellEx.DataCell.DataCellPk.TimeId = TimeTargetId
itemDataCellEx.DataCell.DataCellPk.ScenarioId = ScenarioTargetId
listDriversDataCellExFilterdForDriversTarget.Add(itemDataCellEx)
Next itemDataCellEx
Now, I was trying to update this to only copy data where UD3=None, but I am not sure on how to do that. I can see datacells have a function called GetUD3Name, but the function requires a FinanceRulesApi parameter.
Would using the GetUD3Name function work for my scope and what would be an example of valid FinanceRulesApi parameter?
Thank you
Switch the problem around: retrieve the ID of that member (with brapi.Finance.Members.GetMemberId), before you even enter the loop, and then compare that ID with the one of the cell inside the loop. Among other things, it will be much faster than looking up a member name with every iteration. Ideally, you always work with member IDs rather than names.
When you do that, probably you'll also discover that "None" always has the same ID ( -999 ) in all dimensions, so you don't really need to look it up; although, if you wanted to follow absolute best practices, you would pull it from DimType.<your dimension>.DefaultMemberId.