Options

filter

sharon95sharon95 Member Posts: 183
Hi all, I have a question... the option field "Type" on the Sales Invoice Line has options (" ",Account (G/L),Item,Resource,,Charge (Item),,,,,Header,Begin-Total,End-Total);
the option field "Service Type" has options (" ",G/L Account,Item,Labor,Ext. Service).

what does the filter SalesInvoiceLine.SETFILTER("Type",'%1',SalesInvoiceLine."Service Type"::"G/L Account"); do?

Thanks

Answers

  • Options
    guidorobbenguidorobben Member Posts: 157
    sets the filter to type=G/L Account.
  • Options
    Slawek_GuzekSlawek_Guzek Member Posts: 1,690
    It sets the filter on th Type field to include only lines of G/L Account type.

    This is becasue G/L Account options on "Service Type" has the same ordinal (1) like G/L Account option in the Type field.

    The reason is that the option values are stored as numbers in the actual tables, and are filtered like numbers.

    If you number the options in the Type field you will get:
    " " -> 0,Account (G/L) -> 1,Item >2,Resource->3,4,Charge (Item)->5,6,7,8,9,Header->10,Begin-Total->11,End-Total->12
    Please note that empty options also counts, therefore resource is number 3, then there is empty option which would be stored as 4, and then the Charge (Item) which is stores as 5

    The same for the "Service Type":
    " " -> 0,G/L Account -> 1,Item->2,Labor->3,Ext. Service0>4

    So the
    SalesInvoiceLine.SETFILTER("Type",'%1', SalesInvoiceLine."Service Type"::"G/L Account")
    
    is exactly the same as
    SalesInvoiceLine.SETFILTER("Type",'%1',1);
    
    which is exactly the same as
    SalesInvoiceLine.SETFILTER("Type",'%1', SalesInvoiceLine.Type::"G/L Account")
    

    I hope this makes sense.

    Slawek
    Slawek Guzek
    Dynamics NAV, MS SQL Server, Wherescape RED;
    PRINCE2 Practitioner - License GR657010572SG
    GDPR Certified Data Protection Officer - PECB License DPCDPO1025070-2018-03
Sign In or Register to comment.