Count lines that duplicated line

darmaadarmaa Member Posts: 65
edited 2014-11-17 in NAV Three Tier
Hello All,
I need to count lines of duplicated some entries as one line grouping by ID. It is additional customized table. Please see attached file. This report cant to use any grouping. So I need to use filter. Please any solution

My filter cannot unique line:
Entry.SETFILTER("Number",'91.7');
IF Entry.FIND('-') THEN REPEAT
Numbers[1]:=Entry.COUNT(); //Numbers[1]+=1;
UNTIL Entry.NEXT=0;

Comments

  • zeonzeon Member Posts: 130
    Hmm, I am not sure I know what you are trying to do...

    Are you trying to count the number a lines with 'aaaaa' and the number of lines with 'bbbbb'? Or are you trying to count the number of lines with a certain Number, like 91.7?
  • darmaadarmaa Member Posts: 65
    I`m trying to count 'aaaa' and 'bbbb' lines
  • navuser1navuser1 Member Posts: 1,329
    darmaa wrote:
    I`m trying to count 'aaaa' and 'bbbb' lines

    Use proper temporary Instance of a table and count the number as below :

    TempInstance.DELETEALL; // Mark Record Variable Instance Temporary in its property                     windows
    IF YourMainTable.FINDSET THEN BEGIN
      REPEAT
        TempInstance.RESET;
        TempInstance.SETRANGE("No.",YourMainTable.ID);
        IF NOT TempInstance.FINDFIRST THEN BEGIN
           TempInstance."No." :=YourMainTable.ID;  // ID Saved in No. column
           TempInstance."Unit Price" :=1;         //Number Saves in Unit Price Column
           TempInstance.INSERT;
        END ELSE BEGIN
           IF TempInstance.GET(YourMainTable.ID) THEN BEGIN
           TempInstance."Unit Price" :=TempInstance."Unit Price"+1; //Number incremented if duplicate ID Found
           TempInstance.MODIFY;
           END;
        END;
      UNTIL YourMainTable.NEXT =0
    END;
    
    TempInstance.RESET;
    IF TempInstance.FINDSET THEN
      REPEAT
       MESSAGE('ID :- %1\ Number :- %2',TempInstance."No.",TempInstance."Unit Price");
      UNTIL TempInstance.NEXT =0;
    
    Now or Never
  • darmaadarmaa Member Posts: 65
    Thanks, navuser1
    It is solved.
Sign In or Register to comment.