Business Logic Framework - How To:
Assuming that you would like to search for all Order Items for Products 1, 2 or 3 the following code snippet shows how to achieve this:
| using (OrderItems orderItems = new OrderItems()) | |
| { | |
| // Set the SearchMode of the field to SearchModes.List if you would like to search for a list of values. | |
| orderItems.ProductID.SearchMode = Akal.QuickObjects.ObjectBase.SearchModes.List; | |
| // Since we are looking for all OrderItems where ProductID might equal to 1, 2 or 3 | |
| orderItems.ProductID.List.CustomValue = "1,2,3"; | |
| // We now set the UseInSearch of the field to true, this will cause the business object | |
| // to use the ProductID field in search criteria | |
| orderItems.ProductID.UseInSearch = true; | |
| this.GridView.DataSource = orderItems.Find(); | |
| this.GridView.DataMember = orderItems.GetResultSetName(); | |
| } | |
| Using orderItems As New OrderItems() | |
| ' Set the SearchMode of the field to SearchModes.List if you would like to search for a list of values. | |
| orderItems.ProductID.SearchMode = Akal.QuickObjects.ObjectBase.SearchModes.List | |
| ' Since we are looking for all OrderItems where ProductID might equal to 1, 2 or 3 | |
| orderItems.ProductID.List.CustomValue = "1,2,3" | |
| ' We now set the UseInSearch of the field to true, this will cause the business object | |
| ' to use the ProductID field in search criteria | |
| orderItems.ProductID.UseInSearch = True | |
| Me.GridView.DataSource = orderItems.Find() | |
| Me.GridView.DataMember = orderItems.GetResultSetName() | |
| End Using |
Also, take a look at the GetDelimetedValue method of the BaseBusinessObject. There are three overloads and they can make it easy for you to generate list values that you can use in searches as shown above.
