Stage 31 of the customer app from the series Building a customer app in Uniface 10 added six services (credit, deadlines, workload, product analysis, service analysis, customer lifecycle) and one test service. Creating seven components by hand in the IDE means many dialogs for the same thing. Earlier stages already created forms from generated XML; for services the same works with a template.
Tested with Rocket Uniface 10.4.03 Community Edition (10.4.03.021) on Windows, October 2026. The app uses SQLite through the SLE driver (SQLite 3.50.2).
The template
An existing small service was exported once with the IDE's XML export. The file contains the component record with the name in two places (ULABEL, UFORM), a timestamp and the script in USCRIPT. Everything else (component type, model entity) stays as exported.
The generator
The script of each new service is a plain text file. Shared helper entries (one number from SQL, SQL literals, formatting cents, HTML escaping, writing a file) are kept in one JSON file and appended where the script asks for them:
def script_of(name): t = open(os.path.join(D, name + '.proc')).read() m = re.search(r'(?m)^#helpers (.*)$', t) if m: t = t[:m.start()].rstrip('\n') + '\n' for h in m.group(1).split(): t += '\n' + H[h] + '\n' return t A small check prints calls to entries that are not defined in the script and stops on entries defined twice or on $instancename calls to missing operations:
def check(name, t): defined = set(re.findall(r'(?m)^(?:entry|public operation) (\w+)$', t)) called = set(re.findall(r'\bcall (\w+)\(', t)) | set(re.findall(r'\bcall (\w+)$', t, re.M)) missing = called - defined own = set(re.findall(r'\$instancename\.(\w+)\(', t)) assert not (own - defined), (name, own - defined) dup = [x for x in defined if len(re.findall(r'(?m)^(?:entry|public operation) %s$' % x, t)) > 1] print(name, 'lines', t.count('\n'), 'missing', sorted(missing), 'dup', dup) assert not dup Then the template is copied with the new name and script. The script goes into XML with html.escape(s, quote=False):
def make(name): t = script_of(name) check(name, t) x = open(T, encoding='utf-8-sig').read() assert x.count('<DAT name="ULABEL">VCARD_SVC</DAT>') == 1 and x.count('<DAT name="UFORM">VCARD_SVC</DAT>') == 1 x = x.replace('<DAT name="ULABEL">VCARD_SVC</DAT>', '<DAT name="ULABEL">%s</DAT>' % name) x = x.replace('<DAT name="UFORM">VCARD_SVC</DAT>', '<DAT name="UFORM">%s</DAT>' % name) x = re.sub(r'<DAT name="UTIMESTAMP">[^<]*</DAT>', '<DAT name="UTIMESTAMP">%s</DAT>' % TS, x) i = x.index('<DAT name="USCRIPT" xml:space=\'preserve\'>') + len('<DAT name="USCRIPT" xml:space=\'preserve\'>') j = x.index('</DAT>', i) x = x[:i] + g.esc(t) + x[j:] open(os.path.join(D, name + '.full.proc'), 'w').write(t) g.write(os.path.join(OUT, name + '.xml'), x) In the IDE
Import XML (menu of the IDE), open the component, compile. All seven services compiled with 0 errors and one warning 1016 (the dummy entity of the template is not in the application model, the same warning every non-database component of this app has).
After the import, the script in the repository was compared with the generated text. The repository is a SQLite file as well; reading the USCRIPT field back and comparing it with the source showed no difference for all seven.
What the compiler found
-
$concattakes at most five arguments. In one service several calls had more; each was error 1000. Every such line was split into two calls.
What the tests found
- Rounding with
%left a fraction (described in a separate post); the rounding is now done in SQL. - The calendar export had a BOM; it is now written with
lfiledump/nobom.
Two things to know when testing in the running app
- The app keeps a component that it has loaded. After compiling a changed form again, the running app still showed the old behaviour until it was restarted.
- A compile click right after an import or a tab switch was sometimes ignored, and the output pane still showed the previous run. Checking the time stamp of the compiled file avoids testing an old version.
Notes
- Only services were created from this template. Forms were generated with their own template in earlier stages.
- The generated XML files and the generator are kept next to the project, so a service can be regenerated after a change in the source text.
![Robot Middleware and ROS2 — Ch.06: ROS2 Security [EN]](https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F3oowmzpb4qkk5km0di1k.png)
![Robot Middleware and ROS2 — Ch.07: ROS2 Lifecycle Management [EN]](https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fx3a51weo0z1ob95yn3x2.png)
![Robot Middleware and ROS2 — Ch.08: ROS2 Deployment and DevOps [EN]](https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F9z4fmoxmqqngiro7boaa.png)
![Robot Middleware and ROS2 — Ch.09: ROS2 for AMR [EN]](https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fmrvn70kciyfra1s6m77r.png)
![Robot Middleware and ROS2 — Ch.10: ROS2 for Physical AI [EN]](https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fboyfq92kdiuwiwz8xsoa.png)
![Robot Middleware and ROS2 — Ch.12: ROS2 Case Studies [EN]](https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fw7pygqy790h9vw6mz16j.png)