Share this page

# nca_java_set_option

Java Object Functions

Sets options when recording a Java object.

    int nca_java_set_option( int option, < option value > );

option | The option to set. Either: JAVA_SAVE_PROP - saves properties of a Java object. JAVA_SEPARATOR - the character that demarcates fields in the object (the default is `|').
< option value > | If option is JAVA_SAVE_PROP: Passes the integer: 0 - Disables saving of properties. 1 - Enables saving of properties. If option is JAVA_SEPARATOR: Passes the desired separator as a char.

The nca_java_set_option function sets options when recording a Java object.

The nca_java_set_option function currently has two available options:

- JAVA_SAVE_PROP. When a Java object is selected in NCA, Vugen does not normally save the properties of the object. Use this option to save properties that can then be retrieved with nca_java_get_value and nca_java_get_value_ex.
- JAVA_SEPARATOR. When your own values contain the character that is also being used as the field separator in the java object (for example, if you use the pipe character, `|', the Java default, in your own data), use this option to change the object's field separator before extracting the values.

This and other nca_java functions can be sent to the server as a single packet by wrapping the set of nca_java calls with nca_step_begin and nca_step_end functions.

## Return Values

Oracle NCA Error Codes

## Parameterization

Parameterization is not available for this function.

## Example

In the following example, a Java object appears and its fields are filled after the button press CONTROL_B_OK_COURT_0. The name of the Java object is CONTROL_BN_SESSION_VALIDATION_0, and its properties and their values (taken from the recording log) are as follows:

    Example: Server Message Properties: action=2 handlerClassId=0x10F handlerId=84
    property=402 type=0xE008 value=Message
    Sub Message Properties: action=2 handlerClassId=0x10F handlerId=84
    property=403 type=0x4000 value="sessionId"
    property=404 type=0x4000 value="381"
    property=403 type=0x4000 value="sessionType"
    property=404 type=0x4000 value="A"
    property=403 type=0x4000 value="traceMask"
    property=404 type=0x4000 value="0"

    The handlerClassId field identifies it as a Java object. The first property is sessionId and its value is "381". The example uses the JAVA_SAVE_PROP option of nca_java_set_option to enable Vugen to save all the values. It then retrieves the sessionId value from the object.

    The example also uses nca_java_set_option to change the separator from the default `|' character to `#', because the user already uses `|' as data in the fields.

    char *java_value;

    nca_java_set_option(JAVA_SAVE_PROP, 1);
    nca_java_set_option(JAVA_SEPARATOR, '#');

    nca_set_window("Libra");

    /* The Java object is created after the call to nca_menu_select_item */
    nca_menu_select_item("Libra", "Results;Confirm Sessions");
    nca_button_set("CONTROL_LIST_TYPE_R_ADMIN_0",1);
    nca_button_press("CONTROL_BUT_FROM_DATE_0");
    nca_set_window("Calendar");
    nca_button_press("CALENDAR_OK_0");
    nca_set_window("Session Confirmation");

    /* The Java object's fields are created after this operation */
    nca_button_press("CONTROL_B_OK_COURT_0");

    /* Get one the Java object's properties: the session id */
    nca_java_get_value_ex("CONTROL_BN_SESSION_VALIDATION_0", "sessionId", java_value);
    lr_output_message("value=%s", java_value);
    nca_java_delete_name("CONTROL_BN_SESSION_VALIDATION_0", "sessionId");

Tips to improve your search results... VuGen Function Reference Version 26.1 Function Reference 26.1 All View Local Help Center View Online Help Center Version: