Pos. the Cursor to the last line in Customer Sales History

WinfriedBarzWinfriedBarz Member Posts: 38
Hallo,
I would like to postion the cursor to the last line in the Customer Sales History, so that the newest line is shown directly and the user don+t have to scroll down every time.

I want to do this with

IF FIND('+') THEN;

This is working fine in other forms but in the Customer Sales History I can't find the place to insert this command. Can anybody help me?
Best Regards
Winfried Barz

Comments

  • ara3nara3n Member Posts: 9,257
    On sales history there are subforms.
    So your code will not work.
    In sasle history form there is a function called
    SetSubMenu(MenuType : Integer;Visible : Boolean)

    Before the subform are made visible you have to set the record

    CurrForm.BillSalesLines.VISIBLE := Visible;
    CurrForm.SalesLines.VISIBLE := Visible;
    CurrForm.BillPostedShpts.VISIBLE := Visible
    etc ..
    //new code start
    CurrForm.SalesLines.FORM.SETRECORD(last sales line);
    //New Code End
    CurrForm.SalesLines.VISIBLE := Visible;
    
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • WinfriedBarzWinfriedBarz Member Posts: 38
    Thank you,
    but what must I use for "last sales line" ?
    Best Regards
    Winfried Barz
  • ara3nara3n Member Posts: 9,257
    ok I'll write the code for two of them. The rest you can copy just have different tabel

    Here is the code SetSubMenu(MenuType : Integer;Visible : Boolean)
      0..5:
        BEGIN
          IF Visible THEN BEGIN
            IF BillTo THEN BEGIN
              SalesLine.SETCURRENTKEY("Document Type","Bill-to Customer No.");
              SalesLine.SETRANGE("Document Type",MenuType);
              //S001 Start
              LastSalesLine.SETCURRENTKEY("Document Type","Bill-to Customer No.");
              LastSalesLine.SETRANGE("Document Type",MenuType);
              LastSalesLine.SETRANGE("Bill-to Customer No.","No.");
              IF LastSalesLine.FIND('+') THEN BEGIN
                SalesLine := LastSalesLine;
                LastSalesLine.SETRANGE("Document No.",LastSalesLine."Document No.");
              END;
              //S001 End
              CurrForm.BillSalesLines.FORM.SETTABLEVIEW(SalesLine)
            END ELSE BEGIN
              SalesLine.SETCURRENTKEY("Document Type","Sell-to Customer No.");
              SalesLine.SETRANGE("Document Type",MenuType);
              //S001 Start
              LastSalesLine.SETCURRENTKEY("Document Type","Bill-to Customer No.");
              LastSalesLine.SETRANGE("Document Type",MenuType);
              LastSalesLine.SETRANGE("Sell-to Customer No.","No.");
              IF LastSalesLine.FIND('+') THEN BEGIN
                SalesLine := LastSalesLine;
                SalesLine.SETRANGE("Document No.",LastSalesLine."Document No.");
              END;
              //S001 End
              CurrForm.SalesLines.FORM.SETTABLEVIEW(SalesLine);
            END;
          END;    
    


    Now in Form 7172 Sales Lines Subform in function IsFirstDocLine() :
    Add the commented code
    //S001 Start
    SETRANGE("Document No.");
    //S001 End
    TempSalesLine.RESET;
    TempSalesLine.COPYFILTERS(Rec);
    TempSalesLine.SETRANGE("Document Type","Document Type");
    TempSalesLine.SETRANGE("Document No.","Document No.");
    IF NOT TempSalesLine.FIND('-') THEN BEGIN
    
    
    
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • WinfriedBarzWinfriedBarz Member Posts: 38
    Thank you for your help, but the code don´t work.
    Best Regards
    Winfried Barz
Sign In or Register to comment.