Share this page

# nca_set_custom_dbtrace

DB Trace Functions

Sets the custom function that enables DB trace in the application

    void nca_set_custom_dbtrace( long function );

function | The title of the exception.

nca_set_custom_dbtrace sets the custom function that enables DB trace in the application. nca_set_custom_dbtrace and nca_set_dbtrace_file_index may be needed if DB trace cannot be enabled using the built-in mechanism. This may happen in the case of custom applications with a non-standard UI. nca_set_custom_dbtrace sets the custom function which enables DB trace in the application.

## Return Values

No value is returned.

## Parameterization

Parameterization is not available for this function.

## Example

This example shows how to use nca_set_custom_dbtrace and nca_set_debtrace_file_index.

1. Record a business process that enables DB trace.

2. Find the DB trace file index ID.

3. Create a function that captures the trace file index.

4. Add the nca_set_custom_dbtrace function immediately after the nca_connect_server function call.

### 1. Record a business process that enables DB trace

This example shows a typical business process:

Copy code

    /*enable trace*/
    nca_set_window("Navigator - General Ledger, Vision Operations (USA)");
    nca_menu_select_item("N", "Help;Diagnostics;Trace;Regular Trace");
    nca_set_window("Enable Diagnostics");

    nca_response_set_data("Enable Diagnostics",
        "ORACLE Password:==>apps");

    nca_response_press_ok("Enable Diagnostics");
    nca_set_window("Note");
    nca_popup_message_press("Note", "OK");
    /*set file size unlimited*/
    nca_set_window("Navigator - General Ledger, Vision Operations (USA)");nca_menu_select_item("N",
        "Help;Diagnostics;Trace;Unlimited Trace File Size");

### 2. Find the DB trace file index ID

In this step you find the DB trace file index ID. You can find it in the popup window hint:

FND_TRACE_ON (DIR=E:\myOracleServer\visdb\9.2.0\admin\VIS_quest\udump) (FILE_STRING=2184)

To get the file index, use nca_obj_get_info:

Copy code

    char buf[1024], fileindex[32];
    ...
    nca_set_window("Note");
    if (nca_obj_get_info("Note", "msg_text", buf) == E_OK)
    {
        char *pStart = NULL, *pEnd = NULL;
        int iLength;
        pStart = (char*)strstr(buf, "FILE_STRING=");
        if (pStart) {
            pStart += strlen("FILE_STRING=");
            pEnd = (char*)strchr(pStart, ')');
            iLength = pEnd - pStart;
            strncpy(fileindex, pStart, iLength);
            fileindex[iLength] = '\0';
        }
    }
    nca_popup_message_press("Note", "OK");

### 3. Capture trace file index

In this step, you create a function that captures the trace file index Check that the code for finding the db trace file index runs without error. Then create a separate function before the vuser_init function and cut and paste the trace code into the new function. In this example, the function is named `enable_trace`. In the new function, add a call to nca_set_dbtrace_file_index immediately after trace enabling. In following example, you would call it after `nca_popup_message_press("Note", "OK")` .

Copy code

    void enable_trace() {
        char buf[1024], fileindex[32];
        nca_set_window("Navigator - General Ledger, Vision Operations (USA)");
        nca_menu_select_item("N","Help;Diagnostics;Trace;Regular Trace");
        nca_set_window("Enable Diagnostics");
        nca_response_set_data("Enable Diagnostics",
                "ORACLE Password:==>apps");
        nca_response_press_ok("Enable Diagnostics");
        nca_set_window("Note");
        if (nca_obj_get_info("Note", "msg_text", buf) == E_OK) {
            char *pStart = NULL, *pEnd = NULL;
            int iLength;
            pStart = (char*)strstr(buf, "FILE_STRING=");
            if (pStart) {
                pStart += strlen("FILE_STRING=");
                pEnd = (char*)strchr(pStart, ')');
                iLength = pEnd - pStart;
                strncpy(fileindex, pStart, iLength);
                fileindex[iLength] = '\0';
            }
        }
        nca_popup_message_press("Note", "OK");
        nca_set_dbtrace_file_index(fileindex);
        /*set file size*/
        nca_set_window("Navigator - General Ledger, Vision Operations (USA)");
        nca_menu_select_item("N", "Help;Diagnostics;Trace;Unlimited Trace File Size");
    }

### 4. Enable the dbtrace

In this step, you add nca_set_custom_dbtrace immediately after nca_connect_server.

Copy code

    nca_connect_server("myserver.com", "9000", "module=...");
    nca_set_custom_dbtrace(enable_db_trace);

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