Blog navigation

Latest posts

Javascript

A standard API is available in X3 scripts to perform calls to the platform's javascript published functions. It works on code executed from classic pages as well as on V7 (and later) code.

The execution of functions is performed on node.js in javascript. A function can be synchronous or asynchronous. When a function is asynchronous, a parameter of the function defines the callback function; i.e., the function that is called when the execution of the asynchronous function is finished. We use the package streamline.js to make the use of asynchronous functions simple, by adding an "_" parameter that is preprocessed to handle the callback.

This means that if the function has been defined as asynchronous, you have to use the 'wait' value for MODE, and to indicate the place of the callback parameter as it is declared in the function. The values of these parameters will be mentioned in the function definition.

The function fills RESBODY and RESHEAD, and returns the HTTP status (200 if successful).

The complete JSON structure returned is stored in RESBODY as a stringified JSON. If you want to get only one element in the structure, you have to give its name (if it is a property at the first level of the hierarchy) or the path (if it is a nested property). If the property is a single one, it will be returned in a string, otherwise you will get the JSON description of the requested sub-element.

For example, if the function returns a JSON like the following one:

 
Sort by:
  • EXEC_JS / streamline.js / Sage X3 Syracuse Javascript bundles
    EXEC_JS / streamline.js / Sage X3 Syracuse Javascript bundles

    Sage X3: Overcoming Limitations with the Bridge between 4GL and JavaScript Sage X3 4GL can sometimes encounter limitations when developing cryptographic functions. To address this, Sage has devised a solution by creating a 'bridge' between 4GL and JavaScript. This innovative approach involves the creation of JavaScript functions that can be seamlessly integrated at the Syracuse level within the node.js framework. These functions can then be called from Sage X3. This strategy also...

    Read more