Dear Developers,
I want to setfilter all global and shotcut dimensions between purchase line and item budget entry.
Purchase line has 2 global dimensions and Item budget entry has 5 dimensions. Please show me example code.
If you always have to filter for exact values of all five dimensions, get the Dimension Set ID.
If you need more flexibility, you need to "filter" for the shortcut dimensions" in code, retrieving the dimension values of a candidate and verifying, that they match the requirement.
Alternate ways to do this was to store the needed shortcut dimensions in the record, or to create something along the lines of the analysis view for the purchase line. It might be possible to do this with a query object, or with an SQL view, instead of a physical table.
Is below example possible?
ItemBudgetEntry.SETFILTER("Dimension Set ID",PurchaseLine."Dimension Set ID");
I think "Dimension Set ID" includes all dimension combinations
The value in field "Dimension Set ID" in table Purchase Line represents a specific set of dimensions and dimension values.
Example:
GlobalDim1 - Value "A"
GlobalDim2 - Value 100
Dim5 - Value "XYZ"
The combination of this dimension codes and dimension values codes are represented by the dimension set ID.
ItemBudgetEntry.SETFILTER("Dimension Set ID",PurchaseLine."Dimension Set ID");
with this code, you get a record set of Item Budget Entries with the same dimension set ID of your purchase line.
ItemBudgetEntry.SETRANGE("Dimension Set ID", PurchaseLine."Dimension Set ID");
or
ItemBudgetEntry.SETFILTER("Dimension Set ID", '%1', PurchaseLine."Dimension Set ID");
Apart from that tiny mistake, yes that is a bit ol legit code. Question is what it is supposed to do.
The "Dimension Set ID" value on a particular PurchaseLine "stores" all dimensions assigned to that particular line. If you have only two dimensions assigned to PurchaseLine the "Dimension Set ID" value will correspond to those two and and only those two dimensions only. If you use that "Dimension Set ID" to filter ItemBudgetLine you will get all ItemBudgetLines having exactly the same two dimension assinged to them
If you have 5 dimensions on each ItemBudgetLine entry, the filter will not match anything, because the "Dimension Set ID" for two specific dimensions will be different than "Dimension Set ID" for any other combination of 5 dimensions, even if some of them include the same two dimensions as stored on Purchase Line.
If you want to find all ItemBudgetEntry entries which, among others, include the same two dimensions as found on a purchase line you need to build a filter including several "Dimension Set ID" values, each including the two dimensions of your interest.
Please see below attached picture. I want to chek budget of these items in Purchase Line from ItemBudget Entry. Inorder to checking budget need to filter 5 dimensions. ItemBudgetEntry has 2 global dimensions and 3 shortcut dimensions(Budget Entry dimension3, 4, 5)
Purchase Line has 2 global dimensions and dimension Set ID. How to filter dimension code and dimension value?
If you always have to filter for exact values of all five dimensions, get the Dimension Set ID.
If you need more flexibility, you need to "filter" for the shortcut dimensions" in code, retrieving the dimension values of a candidate and verifying, that they match the requirement.
Alternate ways to do this was to store the needed shortcut dimensions in the record, or to create something along the lines of the analysis view for the purchase line. It might be possible to do this with a query object, or with an SQL view, instead of a physical table.
Answers
Slawek
Dynamics NAV, MS SQL Server, Wherescape RED;
PRINCE2 Practitioner - License GR657010572SG
GDPR Certified Data Protection Officer - PECB License DPCDPO1025070-2018-03
ItemBudgetEntry.SETFILTER("Dimension Set ID",PurchaseLine."Dimension Set ID");
I think "Dimension Set ID" includes all dimension combinations
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!
Example:
GlobalDim1 - Value "A"
GlobalDim2 - Value 100
Dim5 - Value "XYZ"
The combination of this dimension codes and dimension values codes are represented by the dimension set ID. with this code, you get a record set of Item Budget Entries with the same dimension set ID of your purchase line.
It should be or
Apart from that tiny mistake, yes that is a bit ol legit code. Question is what it is supposed to do.
The "Dimension Set ID" value on a particular PurchaseLine "stores" all dimensions assigned to that particular line. If you have only two dimensions assigned to PurchaseLine the "Dimension Set ID" value will correspond to those two and and only those two dimensions only. If you use that "Dimension Set ID" to filter ItemBudgetLine you will get all ItemBudgetLines having exactly the same two dimension assinged to them
If you have 5 dimensions on each ItemBudgetLine entry, the filter will not match anything, because the "Dimension Set ID" for two specific dimensions will be different than "Dimension Set ID" for any other combination of 5 dimensions, even if some of them include the same two dimensions as stored on Purchase Line.
If you want to find all ItemBudgetEntry entries which, among others, include the same two dimensions as found on a purchase line you need to build a filter including several "Dimension Set ID" values, each including the two dimensions of your interest.
Slawek
Dynamics NAV, MS SQL Server, Wherescape RED;
PRINCE2 Practitioner - License GR657010572SG
GDPR Certified Data Protection Officer - PECB License DPCDPO1025070-2018-03
We'd really need this, or at least a much more thorough description of what exactly you want to achieve.
Purchase Line has 2 global dimensions and dimension Set ID. How to filter dimension code and dimension value?
If you need more flexibility, you need to "filter" for the shortcut dimensions" in code, retrieving the dimension values of a candidate and verifying, that they match the requirement.
Alternate ways to do this was to store the needed shortcut dimensions in the record, or to create something along the lines of the analysis view for the purchase line. It might be possible to do this with a query object, or with an SQL view, instead of a physical table.