Community
Showing results for 
Search instead for 
Do you mean 
Reply

Monster Database

Copper Contributor
Posts: 34
Country: United States

Monster Database

Hello,

 

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 contacts

      if (ContactName.FullName == null)

     {

     //do nothing.

     }

     else

     {

          //Check for name match

           if (ContactName.FullName == ContactFullName)

          {

          References.ActApp.UIContactManager.ShowContact(ContactName);

          }

     }

}

 

 

 

 

P.S. Yes I will be discussing with them optimization and stale contacts etc.

Was this post helpful? If so please take a moment to learn a little bit about my ACT! products for yourself or resell to your clients.

Thank You
JB

http://www.axciant.com/act/actrecordescape.asp
Bronze Elite Contributor
Posts: 2,115
Country: United_Kingdom

Re: Monster Database

Hiya,

 

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?

 

HTH

Vivek

Vivek Gargav
Caldere Associates Ltd.
www.caldere.com
vgargav@caldere.com
My Blog
Copper Contributor
Posts: 29
Country: USA

Re: Monster Database

Instead of doing a foreach, use an iterator and do it that way.  I've seen foreach get really slow for larger collections of objects.
Nickel Elite Contributor
Posts: 937
Country: USA

Re: Monster Database

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.