Ask Reuben

Genero Interface Possibilities

I would like Genero to do ????

I was recently in contact with a number of Genero developers where a question was asked along the lines of what would you like Genero to be able to do?  When reviewing the answers, there was a good proportion of replies where I thought “Genero can do that now if you use …”.  In this article I want to list the possible interfaces to/from a Genero application so that you are aware and can possibly construct a solution via one of these interfaces.

Before I list them, it is important to note the Genero architecture, and in particular the run-time system and the front-end.  You have the Genero run-time (fglrun) talking to a GUI front-end (gdc.exe, gbc.js, …)  Any interface it is important to note if it is an interface to the run-time or if it is an interface to the front-end?   An interface to the runtime cannot have any GUI elements whilst an interface to the front-end does not have access to what is on the run-time system.

Understanding and being able to distinguish run-time and front-end is important when it comes to figuring out what your interface options are, and why there are certain restrictions such as no GUI in run-time interfaces.

Run-time Interfaces

JAVA Interface

The Java Interface allows you to import Java classes and instantiate Java objects from your 4gl code.

By using the IMPORT JAVA instruction, you can call Java libraries from your 4gl code.

Before we added the Regexp class for regular expressions, the JAVA Interface was the popular way to code regular expressions in a 4gl application.  Now the most popular uses are for the Apache POI library to interface with Excel, and the crytography classes.  My recommendation is to hide the Java complexity from your junior developers and provide an intermediate 4gl library like that I did with the fgl_apache_poi library.

In theory, anything a Java programmer can do, a 4gl developer can do with the three limitations noted here.  To expand on those three limitations …

  1. as noted it is not possible to instantiate a class without the type parameter.
  2. you can have multiple database connections in your Genero run-time, and you can have more database connections in your Java code, what you can’t do is share a database connection between the two.
  3. the reason that Java graphical objects cannot be used in Genero forms is that the Java Interface is with the fglrun run-time, not the gdc.exe/gbc.js front-end process

There maybe one or two other restrictions that are due to the Genero run-time/front-end architecture.  One I came across recently, how do you interrupt a long running Java process using the interrupt button?

One point to be aware of with the JAVA interface is that its use instantiates a Java Virtual Machine (JVM).  This can take some time and for repeated calls you might find there is a performance advantage by placing the Java code in a Web Service so that it only instantiates a JVM once.  See here for an example, and also note that Genero Report Writer distributed processing achieves its performance gains by doing something similar.

If you see a Java library you would like to use, as long as it does not have any GUI elements to it, you can incorporate it in your Genero application via IMPORT JAVA.


C-Extensions were the historical way that Genero and before that Informix-4gl applications called libraries that were not available in Genero.

If you have a shared object (.so) or DLL (.dll) then you can create a wrapper and use the IMPORT instruction to call the c code in the shared object / DLL.

Before libraries such as base.Channel, util.Regexp, os.Path, util.Math were added to Genero, 4gl applications regularly incorporated c-extensions.  Now it is rare for a Genero application to use a c-extension as the functionality is now in Genero.  Some sites have removed their c-extensions entirely and been able to replace them all with Genero code.

One of the negatives of using a c-extension is that you have to recompile them for every operating system you support.  For those ISV’s that were selling to both Windows and Linux/Unix environment, this required some duplication of effort on their part.


Any command that can be executed at the command line of the run-time system can be executed from a Genero application via use of the RUN instructions.

If the command has any GUI elements, as it is executed on the run-time system, it won’t be visible to the end user unless the command being executed is a fglrun command to run another Genero application with the same FGLSERVER environment variable.

So apart from launching child Genero programs via RUN, RUN WITHOUT WAITING, this command is typically used to execute batch processes on the run-time system.

Note that RUN RETURNING returns the result status of the command.  If you want a value (more than just a result status) to be returned then using base.Channel is the better option as it can read stdout.


The base.Channel class provides some basic input/output functions.  Whilst you may think of it for reading/writing files via openFile, it can also be used for

These interfaces do have to fit in with the Genero framework.  The most noticeable constraint being that Genero is single threaded so the Genero run-time will wait for a response so you may end up with these calls in a seperate dedicated fglrun process.

Web Services

Web Services is the option I look for when having to interact with a 3rd party system.  You will typically find some Web Service API documentation that details how to interface with a 3rd party system.

Genero can be used to interact with most web services, even though the web service might not have a Genero example in its documentation

The fact that can mislead is that sites will typically have examples in certain programming languages and Genero is not popular enough to appear on this list.  As an example, this Twilio API for sending SMS messages lists a few programming languages.  Any programming language can be used to interface with a web service, the key is being able to make HTTP Requests and receive HTTP Responses which is what the Http classes give.

The key when usign Web Services is to find the API documentation, wether it is a web page or wether it self publicises its API via an openapi or WSDL file or URL.  Once you have coded one web service, the rest normally follow pretty quickly once oyu have got used to the terminology.

Front-end Interfaces


In the same way that RUN allows you to interact with the run-time system, Front-Calls are the means to interact with the front-end system.

We supply a number of Built-in front-calls.  What you can also do is write your own front-calls.  These will be dependent on the front-end.  For example some front-calls can only be executed when the Genero Desktop Client is running.  This is because the GDC as an executable can interact with the front-end with less restrictions than a Web Browser executable.

For a custom front-call for the GDC, you are making use of shared libraries on the front-end similar to how c-extensions use shared libraries on the run-time system.  You are typically this using to interact with an application on the end-users PC.  One of the first instances this was used for in the early 2000’s was to interact with a telephony system that was sitting on the end-users PC.  A phone call would be received by the operator and the Genero application would be launched with screens containing information about who is making the phone call.

For a custom front-call for a browser, you can execute some javascript code in the browser.  A simple example you can use to teach yourself is to execute the alert() javascript function to display a message.  A more interesting example I illustrated in this example to use the WebAudio API to play a beep without needing a sound file.

Web Components

The Genero User Interface is made up of a number of containers and widgets.  These control what appears in a rectangular area of the form.  If you want to go outside these options then you can make use of the Web Component widget.  This gives you a rectangular area in the form where you have control over what is rendered.  Instead of Four Js deciding the HTML/CSS/Javascript that is used, you (or a 3rd party) control the HTML/CSS/Javascript that is used.

Using a Web Component, almost anything a Web Developer can render, you can render inside your Genero form.

A Web Component is what you can use for chart, graphs, infographics, maps, signature capture, video etc.  Any rendering that is not catered for by one of our standard widgets can be done via a Web Component.

Using a URL based Web Component you can use Web Components that are hosted on a third party server.  Or you can use gICAPI Web Component where you bundle the HTML/CSS/Javascript (yours or a third parties) in with our compiled objects.  We even supply some built-in web components to save you some of that effort.  The FGLSVGCANVAS built-in Web Component gives you a good ability to draw what you want rather than being constrained by a third party.

One point also to note with web components, you can react to user activity inside that web component.  They aren’t just used for rendering, you can respond to mouse events etc. within the component.

GBC Customisation

The concept of GBC Customisation also gives you control over the HTML/CSS/Javascript that make up the Genero User Interface.  In particular you can extend or override widgets.  You can choose wether to slightly modify an existing widget or to render something completely different in its place.

To illustrate this, think of the PROGRESSBAR widget.  A ProgressBar graphically displays an integer value between VALUEMIN and VALUEMAX by using a thin horizontal line.  If you look around, you will see many different widgets that are capable of displaying an integer value between two values.  Consider the following …

  • speedometer / tachometer on your car
  • battery/fuel gauge
  • graphical equalizer LED display on a stereo
  • a gradient color between two colors
  • a volume knob
  • etc

… all represent an integer between two values.  Using GBC Customisation you can replace our PROGRESSBAR with any one of these or more alternate renderings.

When choosing to override a widget like this, find the widget that has the same properties.  For instance a PROGRESSBAR is read only.  If you wanted the user to change values by interacting with the widget then SLIDER or SPINEDIT  might be more appropriate.

Cordova Plugins

I said for Java topic that “In theory, anything a Java programmer can do, a 4gl developer can do”, something similar can be said for mobile.  Any interaction with the device a Hybrid Web Application for Mobile developer can do, a Genero Mobile developer can do.  This is due to a technology known as Cordova Plugins.

As described here

A plugin is a bit of add-on code that provides JavaScript interface to native components. They allow your app to use native device capabilities beyond what is available to pure web apps.

There is a whole section on Cordova Plugins in our documentation.   To illustrate the concept I like to take something simple such as making a mobile device vibrate.  iOS and Android will have a native call that makes the device vibrate.  A Cordova Plugin will wrap that call so that it is accessible via a Javascript function, in this case navigator.vibrate.  A Genero developer then needs to install that Cordova Plugin and write some wrapper code so that a front-call calls that exposed Javascript function.

Any mobile developer creating hybrid web applications using technologies such as PhoneGap is using the same techniques.

We do have some dedicated front-calls for Genero Mobile.   If you find they don’t have the functionality you need, you will typically find that you can use a Cordova Plugin instead and gain this additional functionality.  An example is the takePhoto front-call, if you want extra options such as resolution consider using a Cordova plugin.  Similarly our barcode front-call recognises certain barcode formats, if you want additional barcode formats or perhaps to read multiple barcodes at once consider a Cordova plugin.

We do have a dedicated Github repository where we have put some wrappers to Cordova plug-ins.  One popular example is the one to interact with devices with bluetooth , and can be seen in use here having been used to interface to a bluetooth scanner that is scanning for microchips implanted inside a racehorse.

Miscellaneous Points

WebComponent vs GBC Customisation

When deciding between Web Component and GBC Customisation, one thing to take into consideration is that at the moment each Web Component rendered on a form effectively instantiates a Web Browser.  Ideally you would not have much more than one WebComponent widget on a form (certainly not 10 or 20) so if you have repeated Web Components on a single form you should investigate overriding a widget via GBC customization.

Genero is single-threaded

Genero is single threaded.  When the run-time executes a call via Java, c, base.Channel, RUN etc.  Unless you use RUN WITHOUT WAITING, there is no getting around that.  Hence you may put these in their dedicated program or web server so as not to block your Genero application.

User Interface must fit the AUI Tree and Protocol

With Genero’s user interface, there is MENU, PROMPT, INPUT, CONSTRUCT, INPUT ARRAY, DISPLAY ARRAY, DIALOG.  Any Web Component or GBC Customisation should work with the appropriate statements.  There is no ability (at the moment) to input a or display a DYNAMIC ARRAY OF STRING via an INPUT or DISPLAY statement.  So just as a Listbox widget is controlled through a DISPLAY ARRAY as part of a multi-dialog statement, something like a Multi-Select widget would need to have its own INPUT ARRAY as part of a multi-dialog statement to input an ARRAY of STRING.

Mobile (Runtime system)

When you package a Genero application up as a Genero Mobile application and install onto a mobile device, it is important to know that you only have access to what the host operating system allows.  There are some limitations.

For GMI applications,  you can write C-extensions for GMI but you can’t utilise the Java interface as there is no free JVM for iOS.

For GMA application, you can utilise Java extensions for GMA, but you can’t utilise C-extensions.

Also note that RUN, RUN WITHOUT WAITING cannot be called by a Genero Mobile application as there is only one runtime thread.


One of my favourite images from the Genero marketing is this one (actually it is my second favourite, there is a version somewhere that is more colourful).  This image can be found here

… like any marketing image, you can look it and think to yourself, I can rearrange it slightly to better match the developers perspective 🙂

My image would have (refer to supported systems documentation for upto date entries)…

  •  Operating Systems (or where the fglrun run-time process can sit) Quadrant
    • Linux
    • Windows
    • OSX
    • AIX
    • Solaris
    • iOS (GMI)
    • Android (GMA)
    • ARM Linux (Raspberry PI etc)
    • Browser (coming soon)
  • Front-Ends (what is responsible for the front-end) Quadrant
    • Character (TUI)
    • Native Desktop  – Windows (GDC)
    • Native Desktop  – Linux (GDC)
    • Native Desktop  – OSX (GDC)
    • Genero Mobile for iOS (GMI)
    • Genero Mobile for Android (GMA)
    • Browser (GBC and previous GWC incarnations)
  •  Databases (via ODI layer) Quadrant
    • Informix
    • Oracle
    • PostgreSQL
    • Oracle MySQL
    • Maria DB
    • Microsoft SQL Server
    • SQLite
    • SAP Hana
  • Languages Center Circle
    • Informix-4gl
    • New Syntax (new syntax such as BOOLEAN, TYPE, RETURNS) Four Js has incorporate in the Genero language
    • Built-in Library
      • base Package
      • om Package
      • ui Package
    • External Packages
      • util Package (includes JSON, Regular Expression)
      • os Package
      • com Package
      • xml Package
      • reflect Package
      • security Package

The fourth quadrant I would label Interface instead of Network and include the different ways Genero has been extended to allow you to interface with third party products and libraries and code.

  • Interfaces Quadrant
    • C
    • JAVA
    • FGL
    • Web Services
    • Files
    • Sockets
    • Pipes
    • RUN
    • Front-call
    • Web Components
    • GBC Customisation
    • Cordova Plugins

All those interfaces are all available to you to include in your Genero solution.  With these interfaces, to reinforce the sentences I added in bold

  • … anything a Java programmer can do, a 4gl developer can do …
  • … Genero can be used to interact with most web services, even though the web service might not have a Genero example in its documentation …
  • … anything a Web Developer can render, you can render inside your Genero form …
  • … any interaction with the device a Hybrid Web Application for Mobile developer can do, a Genero Mobile developer can do …

If you ever get stuck and think Genero can’t do this, ask yourself what would a Java developer do, can I use curl to interact with this web service, what would a Web Developer do, what would a Mobile App developer do, chances are there is a way you can do what you are stuck on and include it in your Genero application.  If you can’t see the coding path to your solution, ask your Genero support contact, they should be able to show you the coding path.