Please enable JavaScript to view this site.

Navigation: Configuration

Dynamic Arrays

Scroll Prev Top Next More

"Dynamic Arrays" are a new feature in LinkarServer. They can be used from LinkarWS or directly from any Linkar Framework client that has access to LinkarServer.

 

This feature allows you to work with data records in JSON, XML formats or with an MV buffer directly.

 

Dynamic Arrays are used by sending that data as subroutine arguments that are sent to a LinkarServer. LinkarServer can convert that data to different formats before sending it to the subroutine.  After conversion the data will be sent to the subroutine for processing. Once the subroutine sends a response LinkarServer can convert it back to another format before returning it.

 

In order to specify which conversion LinkarServer should perform on the subroutine arguments the data has to be encapsulated in specific functions.

 

There are 16 functions in total: 8 functions for JSON - MV conversions and 8 functions for XML - MV conversions.

 

These functions start with the prefixes LK.JSON for JSON data and LK.XML for XML data. Following the prefix will be a first section with any of these 3 words: PARSE, BUILD or NONE. This section controls how to convert the data before reaching the subroutine. After it will follow another section with the same words, which controls how LinkarServer must process the response data from the subroutine before returning it. Following it there is another section where an identifier for the Dynamic Array that will be used for the conversions has to be specified. And finally there is a section with the data to be sent to the subroutine.

 

         LK.JSON.<input.conversion>.<output.conversion>.<dynarrId>(data)

         

         LK.XML.<input.conversion>.<output.conversion>.<dynarrId>(data)

 

         PARSE: From JSON/XML to Buffer MultiValue

         BUILD: From Buffer MultiValie to JSON/XML

         NONE: No conversion

 

 

 

In a typical use example where we have a .NET application that calls a subroutine on the database through LinkarFramework, or we have an application that uses a LinkarWS EndPoint that calls a subroutine on the database, our application will use JSON records such as:

 

 {"NAME": "customer 20", "ADDR": "address 20", "PHONE": "444 - 444 - 020"}

 

Our database subroutine can't work with JSON data but it can process an MV buffer. The Dynamic Array indicates in which position of the attribute (multivalue or subvalue) each property value must be placed. This way an MV buffer will be built and sent to the subroutine, which will process that data and return a new MV buffer with the response. Before the data is finally returned LinkarServer will convert it back to JSON with the help of the Dynamic Array. When calling the subroutine the original data (the JSON record) and the LinkarServer conversion instructions have to be sent through its arguments. The finalized argument for the subroutine will look like this:

 

 LK.JSON.PARSE.BUILD.BF.LK.CUSTOMERS({"NAME": "customer 20", "ADDR": "address 20", "PHONE": "444 - 444 - 020"})

 

 LK.JSON:                Data is in JSON format.

 PARSE:                Before calling the subroutine convert the data to MV buffer.

 BUILD:                        Before returning the response convert the MV buffer back to JSON.

 BF.LK.CUSTOMER:        ID for the Dynamic Array that will be used for the conversions.

 (data)                        The original data (the JSON record) in parenthesis.

 

The following table shows all the functions LinkarServer can manage.

 

 

PREFIX

JSON or

XML

ACTION

BEFORE

SUBROUTINE

ACTION

AFTER

SUBROUTINE

DYNAMIC

ARRAY

ID

DATA


LK.JSON.

PARSE.

PARSE.

<dynarrID>

(data)

"data" is a JSON record that will be converted to an MV buffer, using the <dynarrID> DynamicArray, before calling the subroutine. The subroutine will return a JSON record that will be converted to an MV buffer using the <dynarrID> DynamicArray and returned by LinkarServer.

LK.JSON.

PARSE.

BUILD.

<dynarrID>

(data)

"data" is a JSON record that will be converted to an MV buffer, using the <dynarrID> DynamicArray, before calling the subroutine. The subroutine will return an MV buffer that will be converted to a JSON record using the <dynarrID> DynamicArray and returned by LinkarServer.

LK.JSON.

PARSE.

NONE.

<dynarrID>

(data)

"data" is a JSON record that will be converted to an MV buffer, using the <dynarrID> DynamicArray, before calling the subroutine. The subroutine response will be returned as is.

LK.JSON.

NONE.

PARSE.

<dynarrID>

()

No conversion will be done before calling the subroutine. The subroutine will return a JSON record that will be converted to an MV buffer using the <dynarrID> DynamicArray and returned by LinkarServer.

LK.JSON.

BUILD.

PARSE.

<dynarrID>

(data)

"data" is an MV buffer that will be converted to a JSON record, using the <dynarrID> DynamicArray, before calling the subroutine. The subroutine will return a JSON record that will be converted to an MV buffer using the <dynarrID> DynamicArray and returned by LinkarServer.

LK.JSON.

BUILD.

BUILD.

<dynarrID>

(data)

"data" is an MV buffer that will be converted to a JSON record, using the <dynarrID> DynamicArray, before calling the subroutine. The subroutine will return an MV buffer that will be converted to a JSON record using the <dynarrID> DynamicArray and returned by LinkarServer.

LK.JSON.

BUILD.

NONE.

<dynarrID>

(data)

"data" is an MV buffer that will be converted to a JSON record, using the <dynarrID> DynamicArray, before calling the subroutine. The subroutine response will be returned as is.

LK.JSON.

NONE.

BUILD.

<dynarrID>

()

No conversion will be done before calling the subroutine. The subroutine will return an MV buffer that will be converted to a JSON record using the <dynarrID> DynamicArray and returned by LinkarServer.

LK.XML

PARSE.

PARSE.

<dynarrID>

(data)

"data" is an XML record that will be converted to an MV buffer, using the <dynarrID> DynamicArray, before calling the subroutine. The subroutine will return an XML record that will be converted to an MV buffer using the <dynarrID> DynamicArray and returned by LinkarServer.

LK.XML

PARSE.

BUILD.

<dynarrID>

(data)

"data" is an XML record that will be converted to an MV buffer, using the <dynarrID> DynamicArray, before calling the subroutine. The subroutine will return an MV buffer that will be converted to XML using the <dynarrID> DynamicArray and returned by LinkarServer.

LK.XML

PARSE.

NONE.

<dynarrID>

(data)

"data" is an XML record that will be converted to an MV buffer, using the <dynarrID> DynamicArray, before calling the subroutine. The subroutine response will be returned as is.

LK.XML

NONE.

PARSE.

<dynarrID>

()

No conversion will be done before calling the subroutine. The subroutine will return an XML record that will be converted to an MV buffer using the <dynarrID> DynamicArray and returned by LinkarServer.

LK.XML

BUILD.

PARSE.

<dynarrID>

(data)

"data" is an MV buffer that will be converted to an XML record, using the <dynarrID> DynamicArray, before calling the subroutine. The subroutine will return an XML record that will be converted to an MV buffer using the <dynarrID> DynamicArray and returned by LinkarServer.

LK.XML

BUILD.

BUILD.

<dynarrID>

(data)

"data" is an MV buffer that will be converted to an XML record, using the <dynarrID> DynamicArray, before calling the subroutine. The subroutine will return an MV buffer that will be converted to an XML record using the <dynarrID> DynamicArray and returned by LinkarServer.

LK.XML

BUILD.

NONE.

<dynarrID>

(data)

"data" is an MV buffer that will be converted to an XML record, using the <dynarrID> DynamicArray, before calling the subroutine. The subroutine response will be returned as is.

LK.XML

NONE.

BUILD.

<dynarrID>

()

No conversion will be done before calling the subroutine. The subroutine will return an MV buffer that will be converted to an XML record using the <dynarrID> DynamicArray and returned by LinkarServer.