The following example shows how to filter the list of facilities based on search criteria. In this case, the goal is to filter the facilities to only those which contain “er” in their name.
// Get the "Springfield" Portfolio (ID "01") from the Data Source "ManagingEnergy Template" ManagingEnergy.Portfolio portfolio = api.PortfolioManager.GetPortfolio("ManagingEnergy_Template", "01");
// Get the list of Facilities contained in the portfolio and fill a FacilityCollection class FacilityCollection facilities = new FacilityCollection(portfolio.GetFacilities(api));
// filter the list to only those facilities containing an 'er' in their name facilities = facilities.FilterByName(new SearchCriteria("er",SearchCriteria.SearchMethod.Contains));
// display the facilities foreach (ManagingEnergy.Facility facility in facilities) Console.WriteLine(facility);
// OUTPUT 1001 - Springfield General Hospital |