Options

Ordering fail

AlkroAlkro Member Posts: 115
Why this code is wrong?
OutMat.RESET;
OutMat.SETCURRENTKEY("Posting Date","Item No.","Entry Type");
OutMat.SETRANGE(OutMat."Posting Date",StartD,EndD);
OutMat.SETRANGE(OutMat."Item No.",'ARG01','ARG99');
OutMat.SETRANGE(OutMat."Entry Type",OutMat."Entry Type"::Output);
IF OutMat.FIND('-') THEN BEGIN
   OutMat.SETCURRENTKEY("Prod. Order No.","Posting Date","Item No.","Entry Type");  //***
   OutMat.ASCENDING(TRUE);  //***

I want, filter with dates input by user, and then order by "Prod. Order No.".

Watching Table 32, there is 20 records that have to appear, but only can show 16... Why?
If I delete lines marked //***, records are correct. How can i change the Key to Order by Prod. Order No.??

Answers

  • Options
    AlbertvhAlbertvh Member Posts: 516
    Hi

    You are setting the key after you have gotten the first record from the previous sorting so the pointer may be at the wrong record when you set the 2nd key.
    best bet would be to set the ranges and then set the 2nd currentkey before the FINDFIRST (FINDSET)


    Albert
  • Options
    AlkroAlkro Member Posts: 115
    Oh... Basic C/AL code ](*,)

    Thank you!
  • Options
    AlbertvhAlbertvh Member Posts: 516
    You're welcome
Sign In or Register to comment.