Community
Showing results for 
Search instead for 
Do you mean 
Reply

IFilterCriteria

Accepted Solution Solved
Tuned Listener
Posts: 2
Country: Poland
Accepted Solution

IFilterCriteria

Hi,

 

I'm trying to search all companies with the same status or with the same name part for example: all companies with a status “factory” or with a name having “%Company%”

Witch kind of iFilterCriteria should I use and how?  InFilterCriteria, ComparisonFilterCriteria how it work?

In SDK documentation I read only where and how to use sortcriteria.

CompanyList cList;

Company cCompany;

 

IFilterCriteria[] lCriteria = ????

 

 

            cList = application.ActFramework.Companies.GetCompanies(null, lCriteria);

            for (int i = 0; i < cList.Count; i++)

            {

              cCompany = cList[i];

              MessageBox.Show(cCompany.Name);

            }

 

I’ll be grateful for every help

 

Darek


Accepted Solutions
Solution
Accepted by topic author dark_p
‎09-25-2015 03:20 AM
Nickel Super Contributor
Posts: 441
Country: UK

Re: IFilterCriteria

Use a lookup not a filter criteria, sample below looks up on company name....

 

Private Function FindCompany(ByVal Name As String) As Act.Framework.Companies.CompanyList 'looks up a company in act based on name 'get the name field Dim cField As Act.Framework.Companies.CompanyFieldDescriptor = FindField("Company") If Not cField Is Nothing Then 'create the lookup Dim lookup As Act.Framework.Lookups.CompanyLookup lookup = ActFwk.Lookups.LookupCompaniesReplace(Name, Act.Framework.Lookups.OperatorEnum.EqualTo, cField) 'run the lookup Dim cList As Act.Framework.Companies.CompanyList = lookup.GetCompanies(Nothing) 'return the list Return cList End If End Function

 

Hope that helps.

 

Tom

View solution in original post


All Replies
Solution
Accepted by topic author dark_p
‎09-25-2015 03:20 AM
Nickel Super Contributor
Posts: 441
Country: UK

Re: IFilterCriteria

Use a lookup not a filter criteria, sample below looks up on company name....

 

Private Function FindCompany(ByVal Name As String) As Act.Framework.Companies.CompanyList 'looks up a company in act based on name 'get the name field Dim cField As Act.Framework.Companies.CompanyFieldDescriptor = FindField("Company") If Not cField Is Nothing Then 'create the lookup Dim lookup As Act.Framework.Lookups.CompanyLookup lookup = ActFwk.Lookups.LookupCompaniesReplace(Name, Act.Framework.Lookups.OperatorEnum.EqualTo, cField) 'run the lookup Dim cList As Act.Framework.Companies.CompanyList = lookup.GetCompanies(Nothing) 'return the list Return cList End If End Function

 

Hope that helps.

 

Tom

Tuned Listener
Posts: 2
Country: Poland

Re: IFilterCriteria

Thanks Tom,

 

it was really helpful

but it was also a little bit tricky. Luckily I found on this forum what "findfield" means Smiley Happy

so once again thank you 

 

Darek