Community
Showing results for 
Search instead for 
Do you mean 
Reply

Contact List to Lookup

Copper Contributor
Posts: 119
Country: USA

Contact List to Lookup

by TDavis on 01-22-2008 2:15 PM

Is there a way to convert a list of contacts to a lookup so that the list can be narrowed by further lookups?

 Tom

Copper Contributor
Posts: 119
Country: USA

Re: Contact List to Lookup

by Mark on 01-22-2008 2:21 PM

Narrowing and appending lookups is done via criteria.  Since an arbitrary set of contacts has no common criteria it can't be used to narrow or append a lookup.

But what you can do is hold on the keys for that contact list and then do the lookup and match the keys you have with the keys that are in the lookup and get rid of any key that doesn't match and you've essentially just narrowed the lookup.

Copper Contributor
Posts: 119
Country: USA

Re: Contact List to Lookup

by Vivek on 01-23-2008 8:00 AM

Hi Tom,

I had a quick scan through the SDK and it might be possible if you use the LookupManager.

so something like:

oFramework.Lookups.LookupContactsNarrow(cList, value,Act.Lookups.OperatorEnum.Contains,oFieldDescriptor);

I haven't tried it myself but am assuming that the method does not require a criteria object and creates one on the fly within the methoid or whatever.

Vivek

Copper Contributor
Posts: 119
Country: USA

Re: Contact List to Lookup

by Mark on 01-23-2008 12:25 PM

That LookupContactsNarrow overload does exactly what I posted above, only it only takes one criteria.

If you want to use more than one criteria then you can do what I posted above.


Mark 

Copper Contributor
Posts: 119
Country: USA

Re: Contact List to Lookup

by TDavis on 01-24-2008 3:59 AM

I can use narrow and also there is a method for lookupcontacts(contact list).  Unfortunately these both return as IContactSource not a Lookup.ContactLookup.  When I display the contacts using these methods in the UI using set current contact list, current contact query I either get an error converting data type or within ACT! there is only the option to replace lookup, not narrow.

 

Tom

Copper Contributor
Posts: 119
Country: USA

Re: Contact List to Lookup

by Mark on 01-24-2008 10:17 AM

You should be able to set the current contact list after getting the result of LookupContactsNarrow.  It is not a ContactLookup because contact lookups are criteria based and a contact list is not criteria based.

It's correct behavior for ACT! to not enable narrow or append because the returned IContactSource is not criteria based.
 

New Member
Posts: 8
Country: USA

Re: Contact List to Lookup

' Suppose you had a contact list called cList from the following code, which looks up contacts by their business address:

Dim oColumn1 As Act.Framework.Lookups.CriteriaColumn

Dim oOperator1 As Act.Framework.Lookups.OperatorEnum

Dim cLookup As Act.Framework.Lookups.ContactLookup

oOperator1 = Act.Framework.Lookups.OperatorEnum.EqualTo

oColumn1 = ActFwk.Lookups.GetCriteriaColumn("TBL_CONTACT", "BUSINESS_LINE1", True)

Dim lCriteria As Act.Framework.Lookups.Criteria() = New Act.Framework.Lookups.Criteria() _

{New Act.Framework.Lookups.Criteria(Act.Framework.Lookups.LogicalOperator.End, CByte(0), CByte(0), oColumn1, oOperator1, criteria)}

cLookup = ActFwk.Lookups.LookupContactsReplace(lCriteria, True, True)

cList = cLookup.GetContacts(Nothing)

' Where criteria is a string containing some business address...

 

'You can then narrow the lookup by business_line2 (an apartment number, for instance) as follows:

oColumn1 = ActFwk.Lookups.GetCriteriaColumn("TBL_CONTACT", "BUSINESS_LINE2", True)

Dim mySource As IContactSource
mySource = ActFwk.Lookups.LookupContactsNarrow(cList, Unit, Lookups.OperatorEnum.EqualTo, oColumn1)

cList = mySource.GetContacts(Nothing)

'where UNIT is a string containing the unit number to narrow by.

Took me a bit to figure it out. Hope it helps someone. Hope it's correct Smiley Happy

-Cameron Barry

cameron@peggyhoag.com

Copper Contributor
Posts: 87
Country: USA

Re: Contact List to Lookup

Since this is such a commonly requested capability, would Sage consider providing the capability, both thru the SDK and thru the UI, to add/narrow a "dirty lookup"?  If there's a means to do it, as Mark describes, then Sage should be able to do it, too.  The fact that at "narrowing and appending lookups is done via criteria" at this point doesn't mean that it has to be done that - working as designed is no excuse for "poor" design (not to slam the designers who may not have thought of this critical feature, but it IS important).

 

How can we get this on the wishlist, not only for the SDK, but for the product as a whole?  maybe for v11/ACT!2009?

Geoff

Geoff Blood ("The ACT! Customizer" )
The New Hampton Group

ACT Development Partner
Serving the ACC community since 1994
Employee
Posts: 236
Country: USA

Re: Contact List to Lookup

I've opened a feature request to allow to append / narrow any lookup, both for in product and in the SDK.  The product team will decide on it and priority at this stage, but I will relay any update to this as I get visibility of it.


Thanks Geoff,

--Xavier

New Member
Posts: 31
Country: USA

Re: Contact List to Lookup

[ Edited ]

I like your code. However, I modified it a little bit and tried it to lookup all the private contacts for a particular user but it keeps on complaining that the column type is of an incorrect type. Here's the code:

 

Dim oColumn1 As Act.Framework.Lookups.CriteriaColumn
Dim oOperator1 As Act.Framework.Lookups.OperatorEnum
Dim cLookup As Act.Framework.Lookups.ContactLookup
oOperator1 = Act.Framework.Lookups.OperatorEnum.EqualTo
oColumn1 = ACTFM.Lookups.GetCriteriaColumn("TBL_CONTACT", "ISPRIVATE", True)

 


Dim lCriteria As Act.Framework.Lookups.Criteria() = New Act.Framework.Lookups.Criteria() {New Act.Framework.Lookups.Criteria(Act.Framework.Lookups.LogicalOperator.End, CByte(0), CByte(0), oColumn1, oOperator1, True)}

 

' It crashes when I do the lookup with the error: "Value does not match the column's datatype"
cLookup = ACTFM.Lookups.LookupContactsReplace(lCriteria, True, True)
ourContactList = cLookup.GetContacts(Nothing)

 

'

Do you have any hints on how to fix this?

 

Writing criterias is probably the biggest step backwards in the new ACT!. Why is it so difficult to do something that is sooo easy!

 

Thanx in Advance

Message Edited by thatch on 05-19-2008 06:28 PM