04-10-2009 12:36 AM
the following loop was just fine until it ran into a customer with 19,000+ contacts and over 50 fields per contact. Do I just have to accept that with that large a dbase it adds up (10-15 sec. load) or is there a faster way?
ContactList cList = References.ActApp.ActFramework.Contacts.GetContacts(null);
//Now we have to pull the contact field to get name??foreach (Contact ContactName in cList)
//Since we can't count on the integrity of the users act dbase we have to handle blank contactsif (ContactName.FullName == null)
//Check for name matchif (ContactName.FullName == ContactFullName)
P.S. Yes I will be discussing with them optimization and stale contacts etc.
04-10-2009 01:52 AM
This might be a bit of a silly reply so I appologise in advance! If you already know the ContactName in advance and you just want to find that Contact in the dB and display it, you might find a slight performance benefit by using the LookupsManager - LookupContactsReplace(...) method and provide the Criteria consisting of the Contact name?
07-24-2009 04:37 PM
It looks like what you are trying to do is get a listing of contacts where the contact name is not null, presumably to display in a list or databind to a grid view?
Your approach here is going to have some scaling issues - it runs a SQL "select all" statement from the database then casts results into an array and iterates through each record applying a filter. This is a fairly resource intensive approach.
Normally if you know the filter criteria like this you can apply that filter before the data retreival and gain quite a bit of efficiency.
You could also call up the OLEDB Provide and run your own SQL to collect this data (select contact from contact where contact is not null). Though the criteria API effectively generates the same SQL for you, accessing directly thorugh the provider gives you a bit more flexibility in creating your own filter criteria.