Sales Document-Verify need to have ITEMS sorted in ASCENDING

emulsifiedemulsified Member Posts: 139
I am having a problem with the report below. ](*,)

I need to have this report SORT/PRINT the ITEMS in ASCENDING order instead of by Line No.

I have tried creating Keys with Document Type,Document No.,Type,No. on the Sales Lines table and setting properties for Sales Lines in this report to SORTING(Document Type,Document No.,Type,No.) ORDER(Ascending) to no avail.

I have also tried several other key combinations and nothing seems to work.

:!: New forum software seems to max out at 60,000 characters per posting so here is my report code via a link:

http://www.webfixnow.com/navicoding/rpt50003.txt
Half-empy or half-full how do you view your database?

Thanks.

Answers

  • DaveTDaveT Member Posts: 1,039
    Hi,

    Your report is printing the sales line from the RoundLoop dataitem. This is using a variable TempSaleLine - you will need to set the key on this to sort the lines.
    Dave Treanor

    Dynamics Nav Add-ons
    http://www.simplydynamics.ie/Addons.html
  • emulsifiedemulsified Member Posts: 139
    I'm not sure exactly how to do that. Can you point me in the right direction?
    Half-empy or half-full how do you view your database?

    Thanks.
  • DaveTDaveT Member Posts: 1,039
    Hi,

    use TempsalesLine.setcurrentkey( "Document Type",Type,"No.","Variant Code","Drop Shipment","Location Code","Shipment Date" ); and it should work
    Dave Treanor

    Dynamics Nav Add-ons
    http://www.simplydynamics.ie/Addons.html
  • emulsifiedemulsified Member Posts: 139
    I've added the code into RoundLoop - OnPreDataItem() at the bottom and it seems to be working.
    [size=150]VATNoError := FALSE;
    ApplNoError := FALSE;
    CurrReport.CREATETOTALS(TempSalesLine."Line Amount",TempSalesLine."Inv. Discount Amount");
    
    MoreLines := TempSalesLine.FIND('+');
    WHILE MoreLines AND (TempSalesLine.Description = '') AND (TempSalesLine."Description 2"= '') AND
          (TempSalesLine."No." = '') AND (TempSalesLine.Quantity = 0) AND
          (TempSalesLine.Amount = 0)
    DO
      MoreLines := TempSalesLine.NEXT(-1) <> 0;
    IF NOT MoreLines THEN
      CurrReport.BREAK;
    TempSalesLine.SETRANGE("Line No.",0,TempSalesLine."Line No.");
    SETRANGE(Number,1,TempSalesLine.COUNT);
    
    [b]//ADDED on 10-14-2008 22:15
    TempSalesLine.SETCURRENTKEY( "Document Type",Type,"No.","Variant Code","Drop Shipment","Location Code","Shipment Date" );[/b][/size]
    

    This code worked -> //ADDED on 10-14-2008 22:15
    TempSalesLine.SETCURRENTKEY( "Document Type",Type,"No.","Variant Code","Drop Shipment","Location Code","Shipment Date" );


    Thank you much.
    Half-empy or half-full how do you view your database?

    Thanks.
  • DaveTDaveT Member Posts: 1,039
    Glad to help :mrgreen: - Can you change the posting attribute to Solved Thanks.
    Dave Treanor

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