To invoke a Blueworx Voice Response for AIX state table, you must use the invokeStateTable() method. Only string parameters may be passed to the state table using this method, so if your state table requires numeric parameters, you will need to invoke it from another state table with the capacity to accept strings from the Voice XML application using the invokeStateTable() method.
For example, the state table you want to invoke, Sample, retrieves values from a database. It has three parameters:
First set up a string array to hold the parameters the state table requires. The Customer number has been obtained from the customer and stored in the variable customer_id. The array must contain exactly the same number fields as the number of parameters required by the state table, any fields not used should be initialized with null values.
<var name="parmArray" expr="new Array('TestDB', customer_id, '')"/> <form id="state_table">
Where 'TestDB' is the database name, customer_id is the customer number, and the third field initialized as null will hold the returned account balance.
vxml2.completionCode; vxml2.completionCodeText; vxml2.returnCode; vxml2.parms.length; // number of returned parameters vxml2.parms[0]; vxml2.parms[1];A non-existent return parameter, such as parms[2] when parms.length==1, has the value "undefined".
Example:
<object name="vxml2" classid="method://com.ibm.wvr.vxml2.NativeAppSupport/invokeStateTable" codetype="javacode-ext"> <param name="setName" value="Sample"/> <param name="setEntryPoint" value="start"/> <param name="setParms" expr="parmArray"/> </object>
To read back the account balance to the customer from the above example, type the following within a prompt tag.
<prompt> your account balance is <value expr="vxml2.parms[2]"/> </prompt>
To assign values returned in the invokeStateTable call to local VoiceXML variables.
<block> <var name="customer_balance" expr="vxml2.parms[2]"/> </block>