!--a11y-->
Criteria Definition 
This function enables you to define criteria for an advanced selection. By defining criteria, you filter the search statement and thus get clearer results.
· You have created an advanced selection. For more information, see Advanced Selection Details.
· You know the names of the tables and fields for the relevant business components you will use for the advanced selection.

There are no validations performed on tables and field names.
· General Criteria Details
You specify:
¡ A name for the criterion. This name is used for your reference and is not visible, while using the criterion in a mobile client application. You also indicate a prefix and a suffix, which denote the start and end of the SQL statement for the criteria. Typically “ ( “ is entered as the prefix and “ ) “ as the suffix.
¡ The category of the criterion. You can choose any of the following types of criteria:
§ Sort Order Criterion: Returns additional fields along with the fixed search result. On choosing this value the Def. Descending? checkbox appears. On selecting this checkbox, the result set of the search performed on this criterion is sorted in descending order.
§ Criteria: When a search is performed on this criterion the records in the result set are displayed in random order.
¡ A separator, which indicates the logical operator between a set of variable values of the criterion. The standard separator used is ‘OR’.

A criterion “Name” has variables “First Name” and “Last Name” and variable values entered are:
First Name Last Name
Pam Barker
Adam Smith
Then, the SQL statement will be constructed as follows:
(Pam AND Barker) OR (Adam AND Smith)
where, “OR” is the separator used between a set of variable values.
¡ The inner operator that is used between the variable values of the criterion. The standard separator used is “AND”. Using the above example, in the SQL statement:
(Pam AND Barker)
AND is the inner separator between the variable values “Pam” and “Barker” for the criterion “Name”.
· SQL Definition
You specify the SQL statement for the criterion. You can use [COND] in the SQL statement when the fields are a part of joined tables and no sub-query is required.
· Filter Option
This field is used only when there are return values when you use an advanced selection. In other words, when additional fields are displayed along with the fixed search result. This filter is based on the SQL statement that you define and acts as a criterion for the return value. You can indicate a fixed value as well as a variable for the filter, where the user can enter a value while using the advanced selection.

You want to display the number of customers with more that five orders in the year 2003. In this case, the “Number of orders in 2003” is the new column that will be displayed when the advanced selection is executed. The SQL statement defined is:
[COND] = (select count(*) from SMOVBAK)
Where,
· [COND] and vbak.sfakna1 = kna1.sfakna1
· vbak.deleted = 0
Here, SMOVBAK refer to the Orders table. To narrow this value down to five orders, you can specify a filter (Fixed Value): 5 <= [COND]
· Copy Options
¡ Copy to Selection enables you to use the criterion and all its details of one advanced selection for another.
¡ Copy allows you to copy the criterion and all its details to another advanced selection. When you use this function, the criterion is saved as its name along with a “_1” in the selected advanced selection, but the criteria tree structure details are not copied. You will need to make changes to the tree structure details in the selected advanced selection.

“Test” is a criterion, after copying it to the “Business Partners” advanced selection; it will be saved as “Test_1”. You can modify the name, if required.
· Criterion Check
Enables you to check the correctness of the SQL statement of the criterion. On executing this function, the SQL server:
¡ Tests the SQL statement with dummy values.
¡ Checks for correct variable numbering.
Once the check is done the Checked checkbox is automatically updated.

It is recommended that you perform the check once you have created variables for the criterion.
· Criteria Tree Structure Definition
You specify the criteria tree structure details, such as the language of the criteria in tree structure. You can construct a criteria tree structure in different languages. In addition, you also specify the sort key, which indicates the position of the criteria in the tree structure in a numerical format. Entries with higher numbers appear first within the tree structure.

You may enter numbers in tens, e.g. 10, 20. This ensures numbering consistency when a new entry is made between existing nodes or between criteria.
· Variable Definition

You can also add variable names to the tree structure after you have created the variables for the criterion. Once you have created variables for the advanced selection, a list of all the variables created will appear on the Variables tile.
By entering variables, you are adding the variables to the criteria tree structure. You specify the:
¡ Name of the variable. The name you enter is displayed in the Input Field tile, while using the advanced selection in a mobile client application.
¡ Language used for the variable name and the help description of the variable. The description you enter is displayed in the Info dialog box, while using the advanced selection in a mobile client application.
¡ ID for the variable. The variable ID must begin with “VAR” followed by numbers. For example, “VAR22”
See also: