HOW TO APPLY FILTER ON VIEWS IN SAGE 300 .NET API

By | November 30, 2021

Sage 300 ERP web screens functionalities are being improved with every new release. Sage300c provides various ways to read records of ACCPAC views by opening and composing the business views in .net API. Sometimes we need to set filter on view records for that purpose Sage300c .net API provides us view’s ‘browse’ method.

New Stuff:- Damaged Data Error in Sage 300

So, in this blog we will discuss about browse method used in .Net API and then we can use various methods like Fetch, Go Next, Go Top etc. to iterate through the records. Syntax for Browse method is:

 “viewName.browse(string filter, bool ascending)”.

The parameters used in this method are as follows:

  1. Filter: Filter is a simple string that will be passed to the browse method in the .net API to retrieve records based on specific filter. Expressions are evaluated strictly from left to right unless expression contains brackets. Operands must have same datatype. If a constant is string, then it must be enclosed in quotes (“”). Boolean fields are always TRUE or FALSE.

            The format of the filter string:

                        “string searchFilter = [(condition)(Boolean Operator)(condition)];”

  • Condition: operands with relational operator.
  • Boolean Operator: AND, OR.
  • Operand: Field name or constants.

             Example of search string can be:

                        “Designation = “Developer” AND (Age > 30 or Age < 40)”

       2.   Ascending: This parameter determines whether the retrieved records should be in ascending            or descending order. It can be either true or false.

Here is the screenshot of sample code:

Code