Database

In the following example you can learn how to build a DB interaction between the IVR application and a remote DataBase.

Here we imagine to make a SELECT FROM WHERE Sql statement inside a post call handling routine using the Finally Box.

First of all you let’s define a new Channel variable inside the project dashboard.

Then we need to declare a connection to an existing DB

In our example we would need to query the table below (tableX):


The query we have performed is:

SELECT field1, field2, field3 FROM tableX

The whole returned resultset is stored in the RESULTSET defined variable.

To retrieve the value of a single field in a row you have to use the following notation (in our example by a NoOp box)

RESULTSET[#row][field_name]

e.g the value of field1 will be store into RESULTSET[0][field1]


Where:

#row: the row number in the resultset. Note that the row numbering start from 0

field_name: the name of the column as named in the DB schema