sharon95sharon95 Posts: 181Member
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?



  • guidorobbenguidorobben Posts: 153Member
    sets the filter to type=G/L Account.
  • Slawek_GuzekSlawek_Guzek Posts: 1,390Member
    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
    which is exactly the same as
    SalesInvoiceLine.SETFILTER("Type",'%1', SalesInvoiceLine.Type::"G/L Account")

    I hope this makes sense.

    Slawek Guzek
    Poszukuje programistow znajacych Microsoft Dynamics NAV
Sign In or Register to comment.