C/C++ Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingC/C++ Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old January 19th, 2006, 12:10 PM
brad.g brad.g is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jan 2006
Posts: 14 brad.g User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 35 m 37 sec
Reputation Power: 0
Checking an xls file against another

Hi people
im learning C++ bit by bit, and ive made some very basic programs,

like you select

WV in a combo box, and it will display wolverhampton on the form.

my manager has asked me to try and make a program what checks two excel files ( .xls ) to see if there is a duplicate on one of them.

for example

each xls file contains a list of clients, the same name cannot be on both files. so lets say the first file has "mr john smith" "142 warbreck road"

the program would read this, then read the other file to make sure mr smith is not also listed in the file ( duplicated )

im not going to be as cheeky as to say will someone type this code for me, chances are no one would reply anyway lol

but if you could tell me to go learn about this component.. or google this word, etc etc it would really help me in learning the parts i need to know..

Any help would be greatly appreciated.

Brad

Reply With Quote
  #2  
Old January 20th, 2006, 10:26 AM
Itsacon's Avatar
Itsacon Itsacon is offline
Command Line Warrior
Click here for more information
 
Join Date: Aug 2004
Location: Sector ZZ9 Plural Z Alpha
Posts: 997 Itsacon User rank is Lance Corporal (50 - 100 Reputation Level)Itsacon User rank is Lance Corporal (50 - 100 Reputation Level)Itsacon User rank is Lance Corporal (50 - 100 Reputation Level)  Folding Points: 911244 Folding Title: Super Ultimate Folder - Level 2Folding Points: 911244 Folding Title: Super Ultimate Folder - Level 2Folding Points: 911244 Folding Title: Super Ultimate Folder - Level 2Folding Points: 911244 Folding Title: Super Ultimate Folder - Level 2Folding Points: 911244 Folding Title: Super Ultimate Folder - Level 2Folding Points: 911244 Folding Title: Super Ultimate Folder - Level 2Folding Points: 911244 Folding Title: Super Ultimate Folder - Level 2
Time spent in forums: 6 Days 14 h 26 m 27 sec
Reputation Power: 5
Send a message via ICQ to Itsacon
AFAIK, is the Excel file format stil proprietary, so not easily (if at all) read from C/C++.

if it were an OpenOffice file, I'd might be able to help you, but not with Excel.

Would it be possible to export the data to a CSV (comma seperated values) file first?
in that case it'd be easy...
__________________
This is my code. Is it not nifty?

"The biggest problem encountered while trying to design a system that was completely foolproof, was, that people tended to underestimate the ingenuity of complete fools."
---Douglas Adams


Join the Itsacon fanclub!    
Zero Tolerance: Spammers banned so far: 280

Reply With Quote
  #3  
Old January 20th, 2006, 11:22 AM
brad.g brad.g is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jan 2006
Posts: 14 brad.g User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 35 m 37 sec
Reputation Power: 0
Yep that would be an option, im flexible

Reply With Quote
  #4  
Old January 20th, 2006, 12:09 PM
Itsacon's Avatar
Itsacon Itsacon is offline
Command Line Warrior
Click here for more information
 
Join Date: Aug 2004
Location: Sector ZZ9 Plural Z Alpha
Posts: 997 Itsacon User rank is Lance Corporal (50 - 100 Reputation Level)Itsacon User rank is Lance Corporal (50 - 100 Reputation Level)Itsacon User rank is Lance Corporal (50 - 100 Reputation Level)  Folding Points: 911244 Folding Title: Super Ultimate Folder - Level 2Folding Points: 911244 Folding Title: Super Ultimate Folder - Level 2Folding Points: 911244 Folding Title: Super Ultimate Folder - Level 2Folding Points: 911244 Folding Title: Super Ultimate Folder - Level 2Folding Points: 911244 Folding Title: Super Ultimate Folder - Level 2Folding Points: 911244 Folding Title: Super Ultimate Folder - Level 2Folding Points: 911244 Folding Title: Super Ultimate Folder - Level 2
Time spent in forums: 6 Days 14 h 26 m 27 sec
Reputation Power: 5
Send a message via ICQ to Itsacon
In that case it's quite doable.
Reading a CSV or TSV file in C/C++ is easily done using the normal file I/O functions.

You read the entire first file to memory, and then read the second file, comparing each item with those store, to see if it's a duplicate.

You might want to have a look at the data types in the C++ Standard Template Library (STL). It has a lot of default listtypes you can use, so you don't have to fiddle around using malloc() and the like. Especially for lists of objects, which you'll be generating, it can save a lot of development time.

Reply With Quote
  #5  
Old January 20th, 2006, 02:28 PM
brad.g brad.g is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jan 2006
Posts: 14 brad.g User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 35 m 37 sec
Reputation Power: 0
brilliant, il give this a try tomorrow, although im lost when it comes to specifying what the program should be searching for.

i think it would be best if i made it check the telephone numbers, as that would eliminate the chance of someone typing the name or address incorrectly.

so how would you go about making the program read the telephone numbers and ignoring the rest of the data, or doesnt it work like that.. sorry for the basic questions

in the mean time il try googling some words.

Thanks again for your help

Reply With Quote
  #6  
Old January 23rd, 2006, 08:03 AM
brad.g brad.g is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jan 2006
Posts: 14 brad.g User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 35 m 37 sec
Reputation Power: 0
hm, well ive gotten a little lost as to opening a file to memory.. read so many different posts on the net about how to do it, its clouded the picture.

not sure if i should point out in using BCB, which has a form which i can put components on to, to make life easier.

ive added a StringGrid to the form, and have figured out how to change the columns labels

Code:
void __fastcall TForm2::FormCreate(TObject *Sender)
{
StringGrid1->Cells[1][0] = "Date";
StringGrid1->Cells[2][0] = "Duplicated by";
StringGrid1->Cells[3][0] = "Located in";
StringGrid1->Cells[4][0] = "Client name";
StringGrid1->Cells[5][0] = "no. & street";
StringGrid1->Cells[6][0] = "town";
StringGrid1->Cells[7][0] = "Postcode";
}


and at a guess i would have to use a variable to tell the program to insert the text in to the next row down?
maybe..

Code:
if lineprompt=1
{
StringGrid1->Cells[1][1] = "23/01/06";
StringGrid1->Cells[2][1] = "Bragot";
StringGrid1->Cells[3][1] = "Jacqui's file";
StringGrid1->Cells[4][1] = "Mr Smith";
StringGrid1->Cells[5][1] = "10 downing street";
StringGrid1->Cells[6][1] = "london";
StringGrid1->Cells[7][1] = "IP30 0QJ";
}


although i know "bragot" "jacqui's file" etc would be inserted using a string, but then how would the program know where to point the string to..... as you can tell im a little ( HA ) lost. but im trying

Reply With Quote
  #7  
Old February 17th, 2006, 10:51 AM
brad.g brad.g is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jan 2006
Posts: 14 brad.g User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 35 m 37 sec
Reputation Power: 0
ok been a little while since i last posted here, heres what ive figured out

ive managed to open a file to memory, and i can do a search by typing in an address in to an edit box, which then checks the string against the master file. if it is found then it displays duplicate found, else not duplicated.


Code:
if (MemoryList->IndexOf(a) > -1)
{
    Edit5->Color = clRed;
    Edit5->Text = "duplicated!";
    PlaySound("C:\\Documents and Settings\\Administrator\\Desktop\\siren.wav", NULL, SND_FILENAME | SND_ASYNC);
}
else
{
        Edit5->Color = clLime;
        Edit5->Text ="Lead is not duplicated!";

}


the thing is, i havew to type the name of the address exactly.

like if i type
16 adlesbury road
it will be found as it exists on the master file

however if i was to type
16 adlesbury
it would not be found as i didnt put "road" on the end

the reason i ask this, is because some of the entries on the master file have rd instead of road , ave instead of avenue , cres instead of crescent etc etc

is there a way i can make a wildcard for instance so i dont have to type the exact name, only part of it?

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingC/C++ Help > Checking an xls file against another


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

 Free IT White Papers!
 
How to Present Effectively Online
This white paper offers practical and actionable advice on the key steps that any presenter should consider as they plan and execute a Webinar or online meeting.

Request Your Free Technology Downloads!
 
Open Source Security Myths
Open Source Software (OSS) is computer software whose source code is available to the general public with relaxed or non-existent intellectual property restrictions (or arrangement such as the public domain), and is usually developed with the input of many contributors.

Request Your Free Technology Downloads!
 
Power and Cooling Capacity Management for Data Centers
This paper describes the principles for achieving power and cooling capacity management.

Request Your Free Technology Downloads!
 
Scalable, Fault-Tolerant NAS for Oracle - The Next Generation
For several years NAS has been evolving as a storage alternative for Oracle databases, and for good reason: NAS is quite often the simplest, most cost-effective storage approach for Oracle. Learn about the benefits that HP's approach to scalable NAS brings to Oracle environments in this comprehensive white paper.

Request Your Free Technology Downloads!
 
Understanding Web Application Security Challenges
This white paper discusses many common threats and preventive measures for Web application security, and explains what you can do to help protect your organization.

Request Your Free Technology Downloads!
 

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway
Stay green...Green IT