Access to data 

Principle

The XTEND server does not have a direct access to the X3 database via a a database connector (type JDBC), but by calling up specialized Web services of type 'Access' (for 'access to data').

These Web services of 'Access' type work like the SQL request call, i.e. they have the same parameters in entry used to pass the selection and setup criteria in issue to send the result of the request again.

These web services are the result of the publication of L4G sub-programs that all present the same interfaces (or parameters). The L4G processings associated to them carry out the following operations:

  • construction of the SQL request
  • execution of the SQL request
  • valuation of the return parameters

The web services of 'Access' type are used to access in read-only mode all the X3 tables and views.

It is possible to customize the L4G processings to add that they recover calculated data as stock or the price of a product.

'Generated access' interface

Implementing web services 'Generated access table' and 'Generated access view' is entirely automatic via the XTEND function XTEND Interface.

The posting of the L4G processing and the publication of the sub-program are generated after the developer has selected the X3 table or view he/she wants to access and after having selected the fields to read.

'Access' sub-program interface

L4G processing

An 'Access' sub-program always needs to check the following interface:

  • 10 parameters in entry which names are fixed (AX*) and that contain the SQL request criteria
  • as much parameters in issue that contain the recordings which are result of the request execution

Subprog ACCTAB( AXPARCOD,AXPARVAL,AXWHRLFTBRK,AXWHRCOD,AXWHROPE,
                AXWHRCODVAL,AXWHRRGTBRK,AXWHRANDOR,AXORDCOD,AXORDTYP,
                FIELD1,FIELD2,FIELD2...
)
#Parameters of the SQL request
    Value Char    AXPARCOD()(1..20)
    Variable Char AXPARVAL()(1..20)
    Value Integer AXWHRLFTBRK(1..14)
    Value Char    AXWHRCOD()(1..14)
    Value Integer AXWHROPE(1..14)
    Value Char    AXWHRCODVAL()(1..14)
    Value Integer AXWHRRGTBRK(1..14)
    Value Integer AXWHRANDOR(1..14)
    Value Char    AXORDCOD()(1..10)
    Value Integer AXORDTYP(1..10)
# Data sent
    Variable Char    FIELD1()(1..)
    Variable Char    FIELD2()(1..)
    Variable ClbFile FIELD3()(1..)
...
$LOADLINE
#This label is called for each recording and in order to value the return parameters
#It is used in personalization mode to add (calculated) specific fields
      FIELD1(WROWPOS) = [F]FIELD1
      FIELD2(WROWPOS) = [F]FIELD2
      FIELD3(WROWPOS) = [F]FIELD3
Return

Sub-program record

The sub-program describes the sub-program parameters, their size and assigns publication groups.

The publication groups for the parameters and the result are fixed:

Parameter

Group

Description

AXPARCOD

AX_PAR

X3 context variable code

AXPARVAL

AX_PAR

X3 context variable value

AXWHRLFTBRK

AX_WHR

Level of opening brackets

AXWHRCOD

AX_WHR

Name of the selection criteria

AXWHROPE

AX_WHR

Comparison operator

AXWHRCODVAL

AX_WHR

Value of the selection criteria

AXWHRRGTBRK

AX_WHR

Level of closing brackets

AXWHRANDOR

AX_WHR

Sequence logical operator

AXORDCOD

AX_ORD

Name of the sort criteria

AXORDTYP

AX_ORD

Value of the sort criteria

FIELD1

RES

Fields for the recordings returned by the web service

FIELD2

RES

Fields for the recordings returned by the web service

FIELD3

RES

Fields for the recordings returned by the web service

'Left list access' interface

This interface is used to see the left list web service of a X3 object as a XTEND data supplier.

In that case, the selection criteria to enter are those used for the left lists.

Add calculated fields ('Access to sub-program')

Customizing interfaces of 'Access' type is necessary, as soon as the user wants to return calculated data such as the price and the availability of a product.

Creation

The method to carry out this type of web service is the following:

1. Create an interface of {'Generated access table/view'} type

Interface that points on the selected table/view.

2. Generate access

The following steps are automatically carried out:

1. Generation of processing and sub-program

2. Generation of web service + publication

3. Copy the interface in an interface of 'Access to sub-program' type

1. Copy the processing and sub-program generated and rename them as wanted

2. Add the parameters to calculate

3. Value the parameters in the $LOADLINE label

4. Generate the access of this new interface

!!Respect the names of the publication groups