Uniface Introduces Dynamic Assignment Files and Expressions for Enhanced Configuration Control

Uniface Introduces Dynamic Assignment Files and Expressions for Enhanced Configuration Control

Customizing Uniface application configuration through assignment files has long been a practice, yet the rigidity of these files often necessitates creating multiple versions for slight variations. For instance, accommodating different user directories or application versions typically demands distinct assignment files, despite minimal differences.

To address this issue, Uniface has introduced dynamic assignment files, offering flexibility through the utilization of environment variables. Rather than hardcoding values, settings can now dynamically derive from environment variables, enhancing adaptability.

However, merely incorporating environment variables might not suffice for all scenarios. Sometimes, it's necessary to extract specific parts of a variable or manipulate it before utilization. For instance, if an environment variable contains the application installation path including the version number, extracting this version number could streamline configuration. To facilitate such operations, Uniface has introduced expressions within assignment files.

Expressions, denoted by "%(expression)", allow for inline evaluation of variables and operations. Drawing inspiration from Uniface's existing syntax within procedural code, expressions enable dynamic computation within assignment files. Variables, both logicals declared in the [logicals] section and environment variables prefixed with "$", can be manipulated using arithmetic operators for numeric values and substring operators for strings.

For instance, consider the following snippet for a hypothetical application "MyApp":

?

[logicals]

nr1 = 150

nr2 = 65

nr_days = %(nr2 + 2 * nr1) ; 365

message = There are %(nr_days) in a year. ; There are 365 days in a year.

home = %( $USERPROFILE ) ; C:\Users\Someone

root = %( home[\\1] ) ; C:

my_app_path = %( $MYAPP_INSTALL ) ; C:\Program Files\MyApp\3.0.4

my_app_version = %( my_app_path[\\4] ) ; 3.0.4

major = %( my_app_version[.1] ) ; 3

minor = %( my_app_version[.2] ) ; 0

[files]

.appext %( home )\my_app%( major )%( minor )\.appext

; .appext C:\Users\Someone\myapp30\.appext

[resources]

%( my_app_path )\usys\myapp.uar


This example demonstrates how expressions can streamline configuration by dynamically generating paths and values based on environment variables and predefined logicals.

Uniface processes assignment files by first parsing the [logicals] section, allowing logicals to be referenced throughout the file. However, within the [logicals] section, the order of declaration is crucial, with variables only accessible if declared earlier in the same section. When including external assignment files using the #file directive, logicals from these files can be utilized in expressions, provided the directive precedes the [logicals] section where they are referenced. Additionally, logicals defined in system-level files can be employed in application-level assignment files, but not vice versa.

In essence, the introduction of dynamic assignment files and expressions empowers Uniface users to craft more adaptable configurations, reducing the need for numerous file variants and enhancing overall manageability.


Nice! A great feature which a lot of people will appreciate.

Aad van Schetsen

Managment Consultant. Subject matter expert in AI, Low Code & No Code. Accomplished sales and technology professional with extensive experience in driving revenue growth and delivering innovative solutions.

10 个月

Finally, Uniface users will really appreciate this.

要查看或添加评论,请登录

Software Imaging的更多文章

社区洞察

其他会员也浏览了