Filter

I have to filter a table with the Vehicle Number that is repeated more than once... How can I do it? Thanks!

Answers

  • mohana_cse06mohana_cse06 Member Posts: 5,504
    you can use setrange on vehicle no. and check whether count is more than 1.
    is that what you need?
  • sharon95sharon95 Member Posts: 183
    for a report
  • vaprogvaprog Member Posts: 1,140
    Hi sharon95,

    you certainly do know this by now, don't you?
    RESET;
    SETRANGE("Vehicle Number",MyNumber);
    IF FINDSET THEN
      REPEAT
        ; // do what you need to do
      UNTIL NEXT = 0;
    
  • sharon95sharon95 Member Posts: 183
    edited 2017-02-03
    vaprog wrote: »
    Hi sharon95,

    you certainly do know this by now, don't you?
    RESET;
    SETRANGE("Vehicle Number",MyNumber);
    IF FINDSET THEN
      REPEAT
        ; // do what you need to do
      UNTIL NEXT = 0;
    

    yes but, I'm doing this in a report and MyNumber is not fixed, but I have to count all vehicle numbers in the table
  • sharon95sharon95 Member Posts: 183
    you can use setrange on vehicle no. and check whether count is more than 1.
    is that what you need?

    no, I'm in a report and I have to filter the records which have the vehicle number repeated more than once
  • mucamuca Member Posts: 42
    So You have report with vehicles. but some vehicles (in table) have the same number.
    You want to know all vehicles that have not unique numbers.

    Add Record variable to report
    for example VehicleCount = record from table Vehicles

    in report trigger OnAfterGetRecord (DataItem=Vehicles)
    write a code

    VehicleCount.SETRANGE("Vehicle Number","Vehicle Number");
    IF VehicleCount.COUNT=1 THEN CurrReport.SKIP;

    so report will skip all vehicles that have unique number.

  • RockWithNAVRockWithNAV Member Posts: 1,139
    If you want to count all vehicle numbers then you can write this

    T.RESET;
    T.SETRANGE("Vehicle Number",MyNumber);
    IF T.FINDSET THEN
    IF T.COUNT > 1 THEN
    TotalVehicleNo := T.Vehicle Number";

    Here you will find only those vehicle number whose count is > 1 means which is repeated.
  • sharon95sharon95 Member Posts: 183
    muca wrote: »
    So You have report with vehicles. but some vehicles (in table) have the same number.
    You want to know all vehicles that have not unique numbers.

    Add Record variable to report
    for example VehicleCount = record from table Vehicles

    in report trigger OnAfterGetRecord (DataItem=Vehicles)
    write a code

    VehicleCount.SETRANGE("Vehicle Number","Vehicle Number");
    IF VehicleCount.COUNT=1 THEN CurrReport.SKIP;

    so report will skip all vehicles that have unique number.

    what is "VehicleCount record from table Vehicles", a global variable for the table? thanks!
  • TiwazTiwaz Member Posts: 98
    sharon95 wrote: »
    muca wrote: »
    So You have report with vehicles. but some vehicles (in table) have the same number.
    You want to know all vehicles that have not unique numbers.

    Add Record variable to report
    for example VehicleCount = record from table Vehicles

    in report trigger OnAfterGetRecord (DataItem=Vehicles)
    write a code

    VehicleCount.SETRANGE("Vehicle Number","Vehicle Number");
    IF VehicleCount.COUNT=1 THEN CurrReport.SKIP;

    so report will skip all vehicles that have unique number.

    what is "VehicleCount record from table Vehicles", a global variable for the table? thanks!

    Yes
  • mucamuca Member Posts: 42
    a global variable for the table?
    >>>>>>>>>>>>>>>>>>>>
    Global varaible of Report !
Sign In or Register to comment.