# Select source records

The second step is to select which records in the source will be processed by Inaport. you can do this by either:

- Selecting a table from the drop down list, or
- Writing a SQL SELECT statement.

Selecting a table from the list is the easiest option. when you do, Inaport will fill in a default SQL statement for you. For Example, if you select the table "MyDataTable", Inaport will write

"SELECT * FROM MyDataTable"

as the default SQL statement. You can modify this statement or write your own. With SQL statements, you can join tables together, select which fields you want, and use WHERE expressions to select a sub-set of records.

### Global Variables

Inaport supports Global Variables, which provide a way to store information to disk between runs of a profile, and pass information between profiles. Global variables can also be used in SQL SELECT statements. For example, if you have created a global variable called "lastInvoiceNumber", it could be used in a SQL SELECT like this:

SELECT * FROM Invoices WHERE invoiceNumber > 'glostr("lastInvoiceNumber")'

For more information about using Global Variables in SQL, see here.

### Filtering Records

This tab also allows you to build Inaport expressions to filter records. To build a filter expression:

1. click "add" next to the filter grid
2. build an expression using the fields of the incoming record. this expression must evaluate to TRUE or FALSE.

All records for which the expression evaluates to TRUE will be excluded from the run.

For more information on using the expression builder to build expressions, see here.

### Exec on Data Error

This allows you to specify an expression to be executed when there is a data error on a record. You can use this, for example, to write a message to a log file (using the log() and logger() functions) or send an email (using the sendemail() function).

Using the doall() function, you can take multiple actions, such as both writing to a log file and sending an email.

An example might be:

doall(log("Data error on record '#recordid'"), sendemail("admin@mycomp.com", "import@mycomp.com", "", "Data error on record '#recordid'", ""))