[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

Sort Records

Posted on 1997-03-29
7
Medium Priority
?
197 Views
Last Modified: 2010-08-05
I have started writing a app which saves information on our customers at work and saves the data as a record to disk.  It is supposed to be tracking our service calls and then we can review, at the end of a twelve month period, how many calls a particualar client has made and what the call involved.

The record is "indexed" by client number.  What I want to do
is scan through the file, sort it and remove any duplicates at the same time.  The most important part is just sorting - by client number.

Any help would be appreciated.
0
Comment
Question by:Stuart_Johnson
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
7 Comments
 
LVL 3

Expert Comment

by:sperling
ID: 1335050
I'm not really sure what you're asking...

Do you want ideas on how to perform a sort on a large set of records? Do you need sorting algorhitms? Any technical problems regarding file read/write/seek?

If it's any of the two first problems, just let me know... If it's something related to implementation, post source...

Regards,

Erik.
0
 
LVL 1

Accepted Solution

by:
bcrotaz earned 150 total points
ID: 1335051
If I was doing this task, I'd use a Paradox table of clients,
linked to a table of service calls.
Sorting it is done for you if you index by client number.
If you make it a unique index, you can't have duplicates
in the first place!

Bryan
0
 
LVL 3

Expert Comment

by:mheacock
ID: 1335052
If you don't want to use the Paradox DB method...here's a pointer...just check out QUICK SORT in any CompSci text.

As long as you data is in a fairly randomized order...as
the calls come in...Quick Sort will perform very well.  It
is the fastest sorting algorithm out there.  If the data is
in a fairly sorted manner, then Quick Sort will perform
poorly.

Are you looking to sort the file, then resave it?  Open at
a later date, sort, save again?  If so, then Quick Sort would not be the method of choice here...perhaps a simple Insertion Sort.

But if the data file will never change, data is simply appended to the end each time, then Quick Sort would be the answer here.

Another thing...you are not going to want to sort solely on the cleint number...since there will be repeats...you need secondary keys (date?) to sort on also for the duplicate cases.

I can post some Quick Sort stuff here if you want...it will not be for your data in particular...but you can easily change it to suit your needs.
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 1

Expert Comment

by:bcrotaz
ID: 1335053
The advantage of using a DB is that you can use a reporting tool such as Quick Report or (if you have the RAM and disk space!) Report Smith to create the end of year/month etc reports.
It is also easy to import the data into a spreadsheet such as Excel.
You pays yer money and takes yer choice!

Bryan
0
 
LVL 3

Expert Comment

by:mheacock
ID: 1335054
I wasn't downplaying the DB route here.  It is probably the
better choice...perhaps not in terms of speed, since all DBs
have horrible overhead...but in terms of extensibility and
the ability to add functionality in the future, the DB choice
is far easier to implement.

But some folks don't want to delve into DBs, so I figured I'd
five him an alternate choice.
0
 
LVL 1

Expert Comment

by:bcrotaz
ID: 1335055
With the visual tools in Delphi, DBs are actually rather easy.
I learnt to use them in two or three days.
The only complex idea is of JOINs, and linked tables.
Apart from that conceptual problem, it's all drag and drop!

This case depends on how fast you need a solution,
how experienced you are with code or databases,
and what size you need the project to be.
I don't think the speed issue is a problem here, as it's
a very simple problem.  With a larger system, the speed
drop using a DB might become noticable.
0
 
LVL 3

Expert Comment

by:mheacock
ID: 1335056
Do you think the original question asker is even listening anymore????
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
Suggested Courses

650 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question