The customer app from the series Building a customer app in Uniface 10 has a service that cleans up data: e-mail addresses to lower case without spaces, "Str." to the full word in street names, country codes to upper case. Each operation takes a dry-run flag and returns the number of rows it would change or did change. Stage 29 gave them a form.
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).
One dispatcher entry
The three operations have the same parameters, so the form does not need three copies of the same logic. One entry picks the operation by a kind:
entry NORM_CALL
params
string pKind : IN
boolean pDryRun : IN
numeric pCount : OUT
string pError : OUT
endparams
if (pKind = "EMAILS")
activate "NORMALIZE_SVC".NORMALIZE_EMAILS(pDryRun, pCount, pError)
elseif (pKind = "STREETS")
activate "NORMALIZE_SVC".NORMALIZE_STREETS(pDryRun, pCount, pError)
else
activate "NORMALIZE_SVC".NORMALIZE_COUNTRIES(pDryRun, pCount, pError)
endif
return $status
end
return $status passes the status of the service call on to the caller.
Dry run, question, real run
entry RUN_NORM
params
string pKind : IN
string pWhat : IN
endparams
variables
numeric vCount
string vError
endvariables
call NORM_CALL(pKind, 1, vCount, vError)
if ($status < 0)
rollback
INFO.NRM_DMY = vError
return -1
endif
commit
if (vCount = 0)
INFO.NRM_DMY = "Nothing to change."
return 0
endif
askmess/question "Change %%(vCount) %%(pWhat) now?~Normalize", "Yes,No"
if ($status != 1)
INFO.NRM_DMY = "Cancelled; %%(vCount) %%(pWhat) would have been changed."
return 0
endif
call NORM_CALL(pKind, 0, vCount, vError)
if ($status < 0)
rollback
INFO.NRM_DMY = vError
return -1
endif
commit
INFO.NRM_DMY = "%%(vCount) %%(pWhat) changed."
return 0
end
The buttons only name the kind and the words for the message:
entry DO_EMAILS
call RUN_NORM("EMAILS", "e-mail address(es)")
return $status
end
Two details:
- After a successful dry run the form commits. The dry run changes nothing in the data, so the commit costs nothing, and if a service ever writes a log row during a dry run, it is kept. An earlier form in this project rolled back after a dry run and lost exactly such a row.
- When nothing is to be changed, the form does not ask at all.
Click test
Test data: one customer e-mail with an upper-case letter and spaces around it, one street with "Str.", one address with the country "de".
- "Normalize e-mail addresses...": "Change 1 e-mail address(es) now?" - No: "Cancelled; 1 e-mail address(es) would have been changed."
- Same button, Yes: "1 e-mail address(es) changed."
- Same button again: "Nothing to change." - no question.
- Streets and countries: one change each after Yes. The list of invalid countries then only showed the address with "XX".
- A user with role READ sees the three buttons dimmed; the two read-only lists stay available.
Notes
- If several operations share a signature, a small dispatcher entry keeps the form short and the behaviour the same for all of them.
- Put the numbers from the dry run into the question.
- Ask only when there is something to confirm.
Top comments (0)