Showing results for 
Search instead for 
Do you mean 

Lookup nonempty fields

Copper Contributor
Posts: 11
Country: United States

Lookup nonempty fields

I am having trouble getting a group lookup working. I have a custom group field called "Delivery Method." I want to find all groups that have something in that field (not null). Here is what I have so far.



// Grab the Act application and framework ActApplication ActApp = Act.UI.ActApplication.Instance; ActFramework ActFwk = ActApp.ActFramework; // Setup columns/fields we need to work with GroupFieldDescriptor cfd1 = ActFwk.Groups.GetGroupFieldDescriptor("Group.Delivery Method",false); CriteriaColumn deliveryColumn = ActFwk.Lookups.GetCriteriaColumn(cfd1);


// Setup sorting SortCriteria[] sortCriteria = { new SortCriteria(cfd1, ListSortDirection.Descending) }; // Setup searching Criteria[] searchCriteria = new Criteria[]{new Criteria(LogicalOperator.End, // This is the end of the criteria (byte)0, // Left parenthesis (byte)0, // Right parenthesis deliveryColumn, // Which column to use OperatorEnum.DoesNotContainData, ValueEnum.Nothing) }; // Nothing in the column


// Do the lookup and make sorted list of results GroupLookup gLookup = ActFwk.Lookups.LookupGroupsReplace(searchCriteria); GroupList gList = ActFwk.Groups.GetGroups(sortCriteria);


MessageBox.Show("Results = " + gList.Count);


 My problem is that all groups are being returned. I've tried a few different operators and values but nothing worked. Where am I going wrong?






Posts: 2
Country: United Kingdom

Re: Lookup nonempty fields

Hello Chad,


It's your 2nd last line. It currently bypasses your searchCriteria.


It should be:

GroupList gList = gLookup.GetGroups(sortCriteria);