Help with SETFILTER

oioi007oioi007 Member Posts: 41
TestTable
No. Customer No.
1 10000
2 20000
3 20000
4 30000
on a Push button I want 3 MESSAGE (FOR EXAMPLE)

'1000'
then
'2000' (once)
then
'3000'

Please Help

CustNo := TestTable."Customer No.";
TestTable.SETRANGE("Customer No.");
TestTable.SETFILTER("Customer No.", CustNo);
IF FINDSET THEN
REPEAT
MESSAGE(CustNo);
UNTIL TestTable.NEXT =0;
Clear(Custno);

Comments

  • Sandeep_PrajapatiSandeep_Prajapati Member Posts: 151
    1) create a key - ["No.","Customer No."]

    In the code...

    2) Set the key ["No.","Customer No."]
    3) loop using repeat.....until
    4) message out in the above loop if current "Customer No." <> previous "Customer No."

    (Use a variable to keep track of previous "Customer No.")

    I hope it helps ....... O:)
    Sandeep Prajapati
    Technical Consultant, MS Dynamics NAV
  • BeliasBelias Member Posts: 2,998
    1.
    TestTable.SETFILTER("Customer No.", CustNo);
    why not using setrange?it's simpler(or more simple?)...
    2. search the forum for the word "distinct"...you should find some topics that solve your problem
    -Mirko-
    "Never memorize what you can easily find in a book".....Or Mibuso
    My Blog
  • oioi007oioi007 Member Posts: 41
    1) create a key - ["No.","Customer No."]

    I'v created

    In the code...

    2) Set the key ["No.","Customer No."]
    TestTable.SETCURRENTKEY("No.,"Customer No.");
    3) loop using repeat.....until
    REPEAT
    MESSAGE(CustNo);
    UNTIL TestTable.NEXT =0;
    4) message out in the above loop if current "Customer No." <> previous "Customer No."
    how??

    (Use a variable to keep track of previous "Customer No.")

    CustNo := TestTable."Customer No."

    I hope it helps ....... O:)

    Correct my code please,
    there is no result :(
  • Sandeep_PrajapatiSandeep_Prajapati Member Posts: 151
    PrevCustno := ''; 
    TestTable.RESET;
    TestTable.SETCURRENTKEY("No.","Customer No.");
    IF TestTable.FINDSET THEN 
    REPEAT 
         if (PrevCustno <> TestTable."Customer No.")  then
            MESSAGE('%1',TestTable."Customer No.");
         PrevCustno  := TestTable."Customer No.";
    UNTIL TestTable.NEXT = 0; 
    
    Sandeep Prajapati
    Technical Consultant, MS Dynamics NAV
  • oioi007oioi007 Member Posts: 41
    Thanks a lot guys :)
  • Sandeep_PrajapatiSandeep_Prajapati Member Posts: 151
    Hi oioi007,

    I would appreciate if, while quoting you can differentiate between the quoted text by somebody else and the things you want to write. I mean, avoid altering or modifying somebody's post while quoting.

    for a good example to how to quote see http://www.mibuso.com/forum/viewtopic.php?t=27110
    Sandeep Prajapati
    Technical Consultant, MS Dynamics NAV
  • garakgarak Member Posts: 3,263
    @oioi007:
    every time the same problem :?:
    Do you make it right, it works too!
  • oioi007oioi007 Member Posts: 41
    garak wrote:
    @oioi007:
    every time the same problem :?:

    yup, the code you wrote didn't work :(
  • oioi007oioi007 Member Posts: 41
    Hi oioi007,

    I would appreciate if, while quoting you can differentiate between the quoted text by somebody else and the things you want to write. I mean, avoid altering or modifying somebody's post while quoting.

    for a good example to how to quote see http://www.mibuso.com/forum/viewtopic.php?t=27110

    you'r right, sorry for that!
  • garakgarak Member Posts: 3,263
    the EXAMPLE work.
    You must it "transfer" to your specification.
    Do you make it right, it works too!
Sign In or Register to comment.