Once you have set up and
initialized your application with the API and loaded a form into memory, your
application is ready to start working with the form. The following code uses getLiteralByRefEx to get a specific value from the
form:
Define the method getBirthDay and
a string variable called temp.
private static int getBirthDay( ) throws Exception
{
String temp;
Call getLiteralByRefEx to
retrieve the literal information contained in the form node PAGE1.BIRTHDAY.value
If the method returns a literal value, convert it into
an integer value; otherwise, indicate that no value was entered into the field
and throw an exception.
if (temp.length( ) > 0)
{
return Integer.parseInt(temp);
}
else
{
throw new UWIException("The birth day was not entered.");
}
}
Define the following methods to
retrieve the user's birth month and year from the input form. These methods
will be exactly the same as getBirthDay except for the parameters passed
to getLiteralByRefEx.
getBirthMonth( ) — retrieves the value PAGE1.BIRTHMONTH.value from theForm.
getBirthYear( ) — retrieves the value PAGE1.BIRTHYEAR.value from theForm.