This class represents filter of
Function and derived classes. The FunctionsFilter can be accessed as a property of a
Page object or can be used as a parameter for
DMObjectsFinder. Specifying more than one matching criterion for the filter (for example, the page on which the matching functions must be placed and the category of the matching functions) causes the returned functions to match both conditions.
This example shows how to filter functions by category:
Project myProject = m_oProject; // A valid project
Page myPage = myProject.Pages[0]; // A valid Page object
// Use a filter to get only functions with category 'Motor'
myPage.Filter.FunctionCategory = Eplan.EplApi.Base.Enums.FunctionCategory.Motor;
// Place all functions with category 'Motor' on page myPage
Function[] functions = myPage.Functions;
// Another way to do the same:
// Use a filter to get only functions with category 'Motor'
FunctionsFilter myFunctionsFilter = new FunctionsFilter();
myFunctionsFilter.FunctionCategory = Eplan.EplApi.Base.Enums.FunctionCategory.Motor;
myFunctionsFilter.Page = myPage;
DMObjectsFinder objFinder = new DMObjectsFinder(myProject);
// Place all functions with category 'Motor' on page myPage
functions = objFinder.GetFunctions(myFunctionsFilter);
The following example shows how to filter by user-defined properties:
Project myProject = m_oProject; // A valid project
Page myPage = myProject.Pages[0]; // A valid Page object
// Define test property
MultiLangString mlsTestValue = new MultiLangString();
mlsTestValue.AddString(ISOCode.Language.L_de_DE, "Test043c");
string strPropertyIdentyfingName = "Page.Test043c";
UserDefinedPropertyDefinition oUDPD = UserDefinedPropertyDefinition.Create(myProject, strPropertyIdentyfingName, UserDefinedPropertyDefinition.Enums.ClientType.Page);
// Set test property on myPage
myPage.Properties[strPropertyIdentyfingName] = mlsTestValue;
// Search page with property value
DMObjectsFinder objFinder = new DMObjectsFinder(myProject);
PagesFilter pagesFilter = new PagesFilter();
PagePropertyList pagePropertyList = new PagePropertyList();
AnyPropertyId anyPropertyId = new AnyPropertyId(myProject, strPropertyIdentyfingName);
pagePropertyList[anyPropertyId] = mlsTestValue;
pagesFilter.SetFilteredPropertyList(pagePropertyList);
Page[] arrPages1 = objFinder.GetPages(pagesFilter);