Uniface 10: Pass Customer IDs Between Forms
Résumé
Pixel shares a Uniface 10 customer-app walkthrough showing how to pass a customer ID through an exec operation and open the overview with the customer already selected. The example uses Uniface 10.4.03, SQLite, and a read-only query to retrieve customer details, helping reduce repeated selection across forms.
DEV Community
One customer, many forms - passing an ID through exec in Uniface 10
The customer app from the series Building a customer app in Uniface 10 has grown to many forms: documents, tickets, company data, channels, opportunities. Each one has its own "choose customer" button. The newest form is a customer overview that should open the others with the customer already set, so the user does not pick the same customer again. 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). An optional parameter on exec The overview itself takes the customer ID as a parameter of its exec operation. Zero means "no customer yet": operation exec
params
numeric pCustomerId : IN
endparams
call SET_LABELS
call SET_RIGHTS
$cCust$ = 0
if (pCustomerId > 0)
call SET_CUST(pCustomerId)
endif
edit
end
The menu opens it without a customer: entry DO_C360
call SESSION_OK
if ($status < 0)
return -1
endif
activate "CRM360_FRM".exec(0)
return 0
end
So far the overview is only opened from the menu. A call with an ID runs the same SET_CUST entry that the "Customer..." button uses after the lookup, and that path was part of the click test. SET_CUST reads the name with a read-only query. The ID is a numeric parameter, so the value that ends up in the SQL text is a number: entry SET_CUST
params
numeric pId : IN
endparams
variables
string vData, vRow, vLast, vFirst
endvariables
sql/data "SELECT LAST_NAME, FIRST_NAME FROM CUSTOMER WHERE CUSTOMER_ID = %%(pId)", "CUSTOMERS"
vData = $result
if (vData = "")
INFO.C360_DMY = "The customer %%(pId) does not exist."
return -1
endif
getitem vRow, vData, 1
getitem vLast, vRow, 1
getitem vFirst, vRow, 2
$cCust$ = pId
CUST_NAME.C360_DMY = "%%(vLast), %%(vFirst) (#%%(pId))"
call DO_OVERVIEW
return 0
end
Forms that already accept the ID The ticket form got the same kind of parameter in an earlier stage: operation exec
params
numeric pCustomerId : IN
endparams
The company data form follows the same pattern and loads the record right away: operation exec
params
numeric pCustomerId : IN
endparams
call SET_LABELS
call SET_RIGHTS
$cCust$ = 0
if (pCustomerId > 0)
$cCust$ = pCustomerId
CUST_NAME.PTY_DMY = "#%%(pCustomerId)"
call LOAD
endif
edit
end
From the overview, opening the ticket form is one activate: entry DO_OPEN_TICKETS
call NEED_CUST
if ($status < 0)
return -1
endif
activate "TICKET_FRM".exec($cCust$)
return 0
end
In the click test the ticket form opened with "Customer #15" filled in. A ticket created there showed up in the overview's ticket list after closing the form. The company data and channel forms opened with the same customer loaded. Forms without a parameter The documents form is older and has an exec without parameters. The rule for this stage was to add new forms and change only the menus, not forms from earlier stages. So the overview only opens it: entry DO_OPEN_DOCS
activate "DOC_FRM".exec()
return 0
end
The user then picks the customer there. That is one extra click, and it is honest about what the form can do. Changing the documents form would have meant changing a tested component for a convenience. Notes A numeric parameter with 0 as "not set" keeps the call from a menu simple: exec(0). The receiving form should load right away when it gets an ID, so the user sees data and not an empty form with a filled-in customer label. When a form has no parameter yet, adding one is a change to that form's interface. In this project that waits until the form is changed anyway.

Powered by Readybot.io