How to setfilter all global and shotcut dimensions?

undy0602undy0602 Member Posts: 67
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.

Thanks,

Best Answer

Answers

  • Slawek_GuzekSlawek_Guzek Member Posts: 1,690
    Could you be more specific, please? Perhaps post some data sample and expected results?

    Slawek
    Slawek Guzek
    Dynamics NAV, MS SQL Server, Wherescape RED;
    PRINCE2 Practitioner - License GR657010572SG
    GDPR Certified Data Protection Officer - PECB License DPCDPO1025070-2018-03
  • undy0602undy0602 Member Posts: 67
    Is below example possible?
    ItemBudgetEntry.SETFILTER("Dimension Set ID",PurchaseLine."Dimension Set ID");
    I think "Dimension Set ID" includes all dimension combinations
  • krikikriki Member, Moderator Posts: 9,112
    [Topic moved from 'NAV/Navision Classic Client' forum to 'NAV Three Tier' forum]

    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!


  • joerg_renzjoerg_renz Member Posts: 29
    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.
  • Slawek_GuzekSlawek_Guzek Member Posts: 1,690
    Hi,
    It should be
    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.

    Slawek
    Slawek Guzek
    Dynamics NAV, MS SQL Server, Wherescape RED;
    PRINCE2 Practitioner - License GR657010572SG
    GDPR Certified Data Protection Officer - PECB License DPCDPO1025070-2018-03
  • undy0602undy0602 Member Posts: 67
    How to match these 5 dimension between ItemBudgetEntry and Purchline? Please show me example
  • vaprogvaprog Member Posts: 1,139
    Could you be more specific, please? Perhaps post some data sample and expected results?

    Slawek

    We'd really need this, or at least a much more thorough description of what exactly you want to achieve.
  • undy0602undy0602 Member Posts: 67
    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?

    73bq7wrwxqoy.png
    o5v7gfxetjl6.png
Sign In or Register to comment.