Obtaining information from state tables

The Call.invokeStateTable() method passes back a StateTableResult object containing a list of parameters in the form of a String array. You can only pass back String parameters from a state table. To retrieve application data from the StateTableResult object you use the following methods…
getParameters(String[] parameters)

Return type: java.lang.String[]

Retrieves the list of parameters returned by the state table. This method takes a String array as a parameter. The array is then updated with the parameters from the StateTableResult object, and returned. The size of the array must be at least equal to the number of parameters returned by the state table, otherwise an exception will be thrown. Passing an array into this method increases efficiency as you can reuse the array. Use null as a parameter to create a new array automatically.

numberOfParameters()

Return type: int

Returns the number of parameters in the parameter list.

getParameter(int index)

Return type: java.lang.String

Retrieves the value of the parameter at the position in the array specified byindex.

parametersHaveChanged()

Return type: boolean

Returns true or false, depending on whether the parameters passed back from the state have changed from the values passed in.

getReturnCode

Return type: int

Retrieves the return code passed back from the state table.

For example, to retrieve the account balance for the Customer number from the DBlookup state table mentioned above:
public void voiceMain() throws WVRException {
  .
  .
  .
  // Invoke the state table
  StateTableResult result = call.invokeStateTable(DBlookup, entryPoint, [customerNumber, accountNumber]);
  String[] balance= result.getParameters()
  .
  .
  .// Process the input, according to the value of balance
}