How I can do this? (Report code question)

DarkHorseDarkHorse Member Posts: 389
Hello, I would like to know how do the following. I have a report with tables "Sales Invoice Line" and filter by the "Order Date" and also the table "Purchase. Inv. Line." I wish that when filter under the "Order Date", automatically on run the report, take the field "Order Date" on the table "Purchase. Inv. Line." and put or filter by the same date. How can I do this?.
Thank you very much.

Comments

  • DaveTDaveT Member Posts: 1,039
    Hi,

    Use the command GETFILTER from the sales line and the apply the filter to the purchase line with SETFILTER
    Dave Treanor

    Dynamics Nav Add-ons
    http://www.simplydynamics.ie/Addons.html
  • DarkHorseDarkHorse Member Posts: 389
    Thankls for reply. Could you put me an example please?, I don't control too much the code.
    Thanks in advance.
  • DaveTDaveT Member Posts: 1,039
    Hi,

    Are you sure it's the "Sales Invoice Line" you need as the order date is not on this table but on the "Sales Invoice Header"?
    Dave Treanor

    Dynamics Nav Add-ons
    http://www.simplydynamics.ie/Addons.html
  • DarkHorseDarkHorse Member Posts: 389
    Yes, sorry, it's a field that I've created.
    Thanks.
  • DaveTDaveT Member Posts: 1,039
    Hi,

    Then - depending on the report structure - I'll assume two dataitems one for "Sales Invoice Line" and one for "Puch. Inv. Line" you need to do the following:

    In the OnPreDataItem of the Sales Invoice Line put the code
    OrderDateFilter := "Sales Invoice Line".GETFILTER( "Order Date" );
    
    where OrderDateFilter is of type text

    then in the OnPreDataItem of the Purch. Inv. Line put the code
    "Purch. Inv. Line".SETFILTER( "Order Date", OrderDateFilter );
    
    Dave Treanor

    Dynamics Nav Add-ons
    http://www.simplydynamics.ie/Addons.html
  • DarkHorseDarkHorse Member Posts: 389
    Great!!!, it works. Thank you very much for your help.
  • DaveTDaveT Member Posts: 1,039
    Glad to Help :mrgreen:
    Dave Treanor

    Dynamics Nav Add-ons
    http://www.simplydynamics.ie/Addons.html
Sign In or Register to comment.