A customer maintenance form in Uniface 10, part 1 - from an empty IDE to working CRUD on SQLite
Most "how to build a CRUD screen" tutorials use a framework that ships with a scaffolding command. This one does not. This is Rocket Uniface 10.4 Community Edition , a 4GL that still runs a lot of insurance, healthcare and public-sector software, and that almost nobody blogs about. The goal for this series: a customer maintenance form, stored in a local SQLite file, that behaves like a business…
This tutorial series demonstrates how to create a customer maintenance form in Uniface 10.4 Community Edition, stored in a local SQLite file. The process unfolds in three parts, eventually resulting in a functional CRUD (Create, Read, Update, Delete) application that behaves like a business application rather than a demo.
The first part focuses on setting up the database, assignment file, modeled entity, painted form, and component scripts for search, create, update, and delete operations. Part two will cover additional features like safe ID assignment, handling unsaved changes, real search with sorting, and duplicate checks. Part three will move business rules into a service and write an automated ProcScript test suite.
The tutorial begins by highlighting the unique aspect of this tutorial - it does not use a framework with a scaffolding command. Instead, it utilizes a plain SQLite file created with any SQLite client. Within the Uniface IDE, a CREATE TABLE statement can be executed, but the editor sends the whole buffer as one script and does not commit automatically. To ensure the CREATE TABLE statement is saved, an explicit COMMIT; should be added at the end of the script.
The assignment file (.asn) in Uniface plays a crucial role in mapping entities to the database. It is where Uniface learns about the database connection. In this tutorial, the file is named ide.asn and can be found under the Uniface Project's directory. Two key sections are present in the file: [PATHS] for defining the database connection, and [ENTITIES] for mapping entities to the database table.
The modeled entity CUSTOMER_MDL is created within the CUSTOMER_MDL model. This entity contains various fields, including CUSTOMER_ID (primary key), LAST_NAME, FIRST_NAME, EMAIL, PHONE, and CREATED_AT. Notably, the email field adheres to specific validation rules, ensuring it is either filled or an error occurs.
A crucial detail to remember is that the field syntax LEN(1-n) should be used for optional fields, such as the email address. An incorrect syntax of LEN(1-100) for an optional field leads to a store status of -1 and a UVALERR_SYNTAX error when saving a customer without an email address.
In painting the form, the CUSTOMER_FRM contains four entities: SEARCH_DMY.NOMODEL, LIST_DMY.NOMODEL, BTN_SEARCH, and RESULT_INFO. The SEARCH_DMY entity holds the search input, button, and result information, while the LIST_DMY entity displays the search results.
Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.