Finding "duplicates" in table

JaydkJaydk Member Posts: 28
Hey.

I am quite new at using navision, so bare with me.

I Have this table which contains some customer complains, i want to loop through this table and find records, which have the same customer numbers, and put those in another table, how can i do this?

i tried using a giant table which have all the customer numbers, in a report, and then indent my table, but that took ~5 minutes to loop through, and that is not an acceptable amount of time.

any other ideas?

Best regards.

Comments

  • SavatageSavatage Member Posts: 7,142
    I assume this is a custm table but now you want to move it to a new custom table.

    I would suggest your "Complaint Table" have at least two keys
    1. Customer No
    2. Complaint # (If you assign a complaint # to each complaint)
    or
    2. Date - Perhaps you log complaints as Per Day.

    This will cut down on duplicates. Two entries cannot have the same key.
    I Have this table which contains some customer complains, i want to loop through this table and find records, which have the same customer numbers, and put those in another table, how can i do this?
    Now if you can re-explain your situation because moving to another table doesn't solve the underlying problem does it? :wink:

    Does the table they are in now have any keys?
    How do you want the stored in the new table to be able to keep track easier?
  • JaydkJaydk Member Posts: 28
    the thread subject title was a bit misleading, sorry about that.

    okay, i will try to re explain!

    Say i have this table which contains the following records :
    CustNo     ComplainNo        ComplainDate
    1                 1                    010808
    1                 2                    030808
    3                 3                    040808
    

    Then i want to loop through the table and find the records with CustNo = 1
    (because more then two complains is present for that Customer)

    then i want to compress and move those two records to single line like this
    CustNo      NoOfComplains          Period
    1                    2                       010808-030808
    
    and then the users of the system would see that cust no 1 have complained 2 times, and then they can lookup to se the detailed complains in the first table.

    confusing ?[/code]
  • garakgarak Member Posts: 3,263
    How is the table structure and indexes in your table where you loop through and how is the structure in your table where your will move the recs :?:

    Your report need a long time. Bute note if you have thousand of records in your table, the report needs only on first run these time.

    So, the best wayto help you is.
    1. what the structure of your "CopiedFromTable" and how many indexes
    2. same question for CopiedToTable
    3. How looks you Copy Report

    Regards
    Do you make it right, it works too!
  • garakgarak Member Posts: 3,263
    edited 2008-08-14
    so you fill a new table with the cust No. and the Count of Complains and the Date String.

    First, you need no code!

    Second, create a form, based on table 18.
    In table 18, create a NEW Flowfield to your Complain table (count TableComplain filter CustNo = No.)

    Now create your form based on Table 18
    Cust No. No of Complans.
    In the field No of Complains the user can drilldown

    The part with the compressed ComplainDate i would not do.
    A max strlen of an field in nav is 250. So what is, when the customer has more complains. These dates could not inserted in your field.

    Regards
    Do you make it right, it works too!
  • SavatageSavatage Member Posts: 7,142
    You could on the customer table add a new field called :
    Complaints = type integer
    FieldClass = Flowfield
    CalcFormula = Count("Your Complaint Table" WHERE (Customer No.=FIELD(No.)))
    **I assume "No." - but whatever the name you use.

    Now add the field using designer to your customer card.
    It will contain a number of complains for that customer.
    If you drill into that number it will show all the complaints for that customer that appear on "Your Complaint Table".

    By the info I see you storing this should not slow down your system, if it does you wouldn't even notice it.

    **EDIT**
    **oops I know it sounds weird but I didn't even read the post above**
    kudos to Garak!
  • KarenhKarenh Member Posts: 209
    Hey.

    I am quite new at using navision, so bare with me.


    Is it all right if we bear with you instead? :mrgreen:
  • garakgarak Member Posts: 3,263
    please write [solved] infront of your subject (in first post) if your question is answered....

    Regards
    Do you make it right, it works too!
Sign In or Register to comment.