RunFilterEx Method |
Sample Code for retrieving the result set of a Filter using the RunFilter method of CampusNexus CRM Utils iService.
In the following sample code we will be retrieving the result set of the Show Alumni Filter, which is configured for the Contact Object. The Show Alumni Filter returns the Contacts that are of type Alumni.
![]() |
---|
To use the RunFilterEx method for retrieving the Filter result set you must create a custom Workspace in Desktop Client and add the required Filter to the custom Workspace Pane. You must get the name of the Pane in the Custom Workspace and the Filter name configured in this Pane, which must be passed in the RunFilterEx method. |
For information on finding the Filter ID configured in a custom Workspace, see Querying Main Database.
public void RunFilterExSample() { // Creating an Instance of the Utils iService UtilsWebService utilService = new UtilsWebService(); // Generating the Username Token Information UsernameToken userToken = getUserToken("ParkerRoy", "password"); // Associating the Username Token Information with the Utils iService Instance utilService.RequestSoapContext.Security.Tokens.Add(userToken); utilService.RequireMtom = false; //Initializing the input parameters string workspaceName = "Alumni Details"; //Name of the custom Workspace where the Filter is configured. string FilterName = "Show Alumni"; // Name of the Filter configured in a pane of the custom Workspace. long keyColValue=-1; //Initially this parameter is set to -1. string sortColValue=""; //Initially this parameter is set to blank. long PageSize = -1; //This parameter is not used in this method. //Declaring the output parameters string results=null; string error=""; long result = 0; long sortColID = -1;// Initially this value is set to -1 to retrieve the first page of the result set. bool bFilterBuilt = false; //Filter is not rebuilt //Calling the RunFilter method to retrieve the first page result result = utilService.RunFilterEx(workspaceName,FilterName,keyColValue,sortColValue,ref sortColID,ref bFilterBuilt,PageSize/*Not Used*/,out results,out error); if (result != 0) { //Handle Error } //Current sorting is on the Contact ID Property so passing the value of this Property in the last row of the first result page to fetch values of the next result page. keyColValue = 2; //ID of the Contact item displayed in the last row of the first result page sortColValue = "2"; //Value of the Contact ID Property that is displayed in the last row of the first result page //Calling the RunFilter method to retrieve the next page result result = utilService.RunFilterEx(workspaceName, FilterName, keyColValue, sortColValue, ref sortColID, ref bFilterBuilt, PageSize, out results, out error); if (result != 0) { //Handle Error } }
Following XML output is returned for the above code in the first call of the RunFilterEx method:
<Result count='23' PS='2' OT='3' SC='15' SO='1'> <H> <D PID='15' WD='100' CID='-1'> <![CDATA[Contact ID]]> </D> <D PID='15' WD='100' CID='-1'> <![CDATA[Contact ID]]> </D> <D PID='56' WD='130' CID='-1'> <![CDATA[Name]]> </D> <D PID='57' WD='200' CID='-1'> <![CDATA[E-mail]]> </D> <D PID='79' WD='116' CID='-1'> <![CDATA[Phone]]> </D> <D PID='126' WD='125' CID='-1'> <![CDATA[Created]]> </D> <D PID='13' WD='100' CID='13'> <![CDATA[No. of Interactions]]> </D> </H> <Data> <R> <D> <![CDATA[1]]> </D> <D> <![CDATA[1]]> </D> <D> <![CDATA[Kay Ross]]> </D> <D> <![CDATA[Kayross@gmail.com]]> </D> <D> <![CDATA[565-434-9752]]> </D> <D> <![CDATA[15-11-2013 03:07]]> </D> <D> <![CDATA[14]]> </D> <SCHV> <![CDATA[1]]> </SCHV> </R> <R> <D> <![CDATA[2]]> </D> <D> <![CDATA[2]]> </D> <D> <![CDATA[Brian Mathew]]> </D> <D> <![CDATA[Brianmathew@gmail.com]]> </D> <D> <![CDATA[566-866-3971]]> </D> <D> <![CDATA[15-11-2013 04:26]]> </D> <D> <![CDATA[0]]> </D> <SCHV> <![CDATA[2]]> </SCHV> </R> </Data> </Result> <R> <D> 3 </D> <D> 3 </D> <D> Sandra Henry </D> <D> Sandrahenry@gmail.com </D> <D> 576-514-4332 </D> <D> 20-11-2013 08:14 </D> <D> 2 </D> <SCHV> 3 </SCHV> </R>
The result set in the above XML code can be interpreted as follows:
-
The Result tag stores two types of tags, the H tag stores the Property names that are displayed in the Table View columns, and the Data tag stores the values of the Properties for each row in an R tag.
Additionally, the Result tag displays the following elements:
-
count - Indicates the total number of records that satisfy the Filter condition. In this example, there are 23 records.
-
PS - Indicates the value of the Page size option. In this example, Pagesize is 2 that is two records will be displayed per page.
-
OT - Indicates the ID of the Object type. In this example, Object type is 3, which is the ID for the Contact Object.
-
SC - Indicates the ID of the sort column in the Table View in CampusNexus CRM. In this example, Contact ID is the sort column with ID as 15.
-
SO - Indicates the sort order of the items in the sort column. In this example, 1 indicates ascending order.
A value of 2 in the SO tag indicates descending order.
-
-
The following table interprets the result set returned in the above XML code.
Property Name |
Values in Row 1 |
Values in Row 2 |
Values in Row 3 |
---|---|---|---|
Contact ID |
1 |
2 |
3 |
Name |
Kay Ross |
Brian Mathew |
Sandra Henry |
|
Kayross@gmail.com |
Brianmathew@gmail.com |
Sandrahenry@gmail.com |
Phone |
565-434-9752 |
566-866-3971 |
576-514-4332 |
Created |
15-11-2013 03:07 |
15-11-2013 04:26 |
20-11-2013 08:14 |
No. of Interactions |
14 |
0 |
2 |
![]() |
---|
|