Tracing in Your Server Side AJAX Functions

Visual LANSA Framework

Tracing in Your Server Side AJAX Functions

You can add tracing to your AJAX functions by using the Framework VF_TRACENVALUE and VF_TRACEAVALUE built-in functions.

The information you trace appears in the trace window when you execute the Framework in trace mode. Here is an example of a AJAX function tracing a FETCH operation:

 

Subroutine Name(GET) 

 

* Get the employee number supplied and trace it  

 

Execute Subroutine(GETA) With_Parms(EMPNO ' ' 1 #EMPNO) 

 

Use Builtin(VF_TraceAvalue) With_Args('GET received employee number' #EMPNO) 

 

Fetch Fields(#PSLMST) From_File(PSLMST) With_Key(#EMPNO) Issue_Msg(*YES) 

 

Execute Subroutine(PUTA) With_Parms(IO_STATUS ' ' 1 #IO$STS) 

 

* If the record was found trace the salary and surname values retrieved 

 

If_Status Is(*OKAY) 

Use Builtin(VF_TraceNvalue) With_Args('GET request found salary' #Salary) 

Use Builtin(VF_TraceAvalue) With_Args('GET request found surname' #Surname) 

 

…etc…  

 

 

VF_TRACEAVALUE and VF_TRACENVALUE

The VF_TRACEAVALUE and VF_TRACENVALUE Built-In functions are used to trace the logic flow and the values of variables in your browser command handlers and filters.

The values that are traced are added to the trace window that is displayed when Framework Web browser applications are executed in trace mode (by adding ?Trace=Y to the URL that Is used to start the application or by checking the Trace Mode On option).  

Generally trace Built-In functions may be left in your code as they are only activated when trace mode is turned on. Do not do this in code sections that are executed many times per interaction.

For use with

LANSA for i

YES

Visual LANSA for Windows

YES

Visual LANSA for UNIX/Linux

NO

    

Arguments

No Type Req/ Opt Description Min Len Max Len Min Dec Max Dec

1

A

Req

Event Description

1

256

 

 

2

A

N

Opt

Alphanumeric Value 1 to trace

Numeric Value 1 to trace

1

1

256

30

 

0

 

9

3

A

N

Opt

Alphanumeric Value 2 to trace

Numeric Value 2 to trace

1

1

256

30

 

0

 

9

4

A

N

Opt

Alphanumeric Value 3 to trace

Numeric Value 3 to trace

1

1

256

30

 

0

 

9

    

Return Values

None.

Technical Notes

The general usage rules apply to this Built-In function.

Examples

Example 1: This code fragment is seen in many applications generated by the Program Coding Assistant:

Use Builtin(VF_TRACEAVALUE) With_Args('#VF_EVENT value is unknown and has been ignored' #VF_EVENT)

 

Example 2: Trace some alpha values:

Use Builtin(VF_TRACEAVALUE) With_Args('Department and section are' #DEPTMENT #SECTION)

 

Example 3: Trace some numeric values:

Use Builtin(VF_TRACENVALUE) With_Args('Salary=' #SALARY)

Use Builtin(VF_TRACENVALUE) With_Args('Zip Code=' #POSTCODE)