 |
The third dialogue form of the given assistant is used to ask for additional
information about the user and to finish the assistant.
The set of buttons is automatically positioned in the lower right corner.
Since there is no succeeding dialogue form, the button has automatically been replaced with the button .
Additionally it is possible to move to the previous dialogue form or to
abort the assistant.

Listing of LogiView procedure :
Line
|
|
Statement
|
10
|
|
RES = # xform_get_ass_wdg (EP_ASS_TOP)
|
20
|
C
|
-- Set person name to account name as default value
|
30
|
|
widget_get_buf(EP_ASS_TOP,"EP_USR_NAM",EP_USR_NAM)
|
40
|
|
widget_get_buf(EP_ASS_TOP,"EP_PRS_USER",EP_PRS_USER)
|
50
|
|
if (EP_PRS_USER == "")
|
60
|
|
|
EP_PRS_USER = strcat(strpart(EP_USR_NAM,1,1), strlower(strpart(EP_USR_NAM,2,20)))
|
70
|
|
|
widget_set_buf(EP_ASS_TOP,"EP_PRS_USER", EP_PRS_USER)
|
80
|
|
endif
|
90
|
|
if (language() == "GER")
|
100
|
|
|
EP_STRING = "Bitte geben Sie die persönlichen Daten
des Benutzers ein. Mit diesen wird ein Eintrag in der Personen-Tabelle
vorgenommen."
|
110
|
|
else
|
120
|
|
|
EP_STRING = "Please enter the personal data of the user.
These data will be used to create an entry in the person table."
|
130
|
|
endif
|
140
|
|
RES = @ xform_call_dlg (strcat("EDB-ASS-USR-PRS
/TEXT=", EP_STRING))
|
Business Application Logic of the third Dialogue Form
The biggest part of the business application logic is defined for the
final dialogue form, as this is the case with most assistants. Here the
LogiView procedure is
defined as the post mask userexit of the dialogue form.
It is a typical feature of an assistant to execute either all steps or
none at all. For this reason, all database operations are enclosed in
a database transaction (line 20 and 410). If any of the database operation
fails, the end of the LogiView procedure is not reached and so the database
transaction will automatically be aborted by LogiView.
Similar to the LogiView procedures before, a reference on the assistant
top widget is determined (line 30). With this widget identifier all values
that have been entered are retrieved (all
statements). The first operation then is to create a DataView user. The
sub procedure 'EP_ASS_TOOLBOX/CreateUser' is called for this purpose (line
80).
The significant identifier of the selected groups can be retrieved from
the widget buffer too, using the name of the target widget as a key (line
100). This comma separated list of group identifier is split into its
components and for each group a corresponding user-group assignment is
created by calling the sub procedure
(line 140). Using the personal data, a new entry in the person table is
created by the sub procedure
(line 320) and an entry in the resource table is created by the sub procedure
(line 390).
Listing of LogiView procedure
Line
|
|
Statement
|
10
|
C
|
-- Perform all database commands within a transaction
|
20
|
|
start_transaction()
|
30
|
|
RES = # xform_get_ass_wdg (EP_ASS_TOP)
|
40
|
C
|
-- Read user values that have been entered and create a user
|
50
|
|
widget_get_buf(EP_ASS_TOP,"EP_USR_NAM",EP_USR_NAM)
|
60
|
|
widget_get_buf(EP_ASS_TOP,"EP_USR_MNG",EP_USR_MNG)
|
70
|
|
widget_get_buf(EP_ASS_TOP,"EP_USR_UIC",EP_USR_UIC)
|
80
|
|
EP_ASS_TOOLBOX/CreateUser(EP_USR_NAM,EP_USR_UIC,EP_USR_MNG)
|
90
|
C
|
-- Split string with group names and create group assignments
|
100
|
|
widget_get_buf(EP_ASS_TOP,"EDB-ASS-GRP-NAM-SLIT",EP_STRING)
|
110
|
|
EP_COUNT = split(EP_STRING,EP_GRP_NAM_ARR[1])
|
120
|
|
while (EP_INDEX <= EP_COUNT)
|
130
|
|
|
if (EP_INDEX == 1)
|
140
|
|
|
|
EP_ASS_TOOLBOX/AssignUserToGroup(EP_USR_NAM,EP_GRP_NAM_ARR[EP_INDEX],"d",TRUE)
|
150
|
|
|
else
|
160
|
|
|
|
EP_ASS_TOOLBOX/AssignUserToGroup(EP_USR_NAM,EP_GRP_NAM_ARR[EP_INDEX],"d",FALSE)
|
170
|
|
|
endif
|
180
|
|
|
EP_INDEX = EP_INDEX+1
|
190
|
|
done
|
200
|
C
|
-- Read person values that have been entered and create person
|
210
|
|
widget_get_buf(EP_ASS_TOP,"EP_PRS_PREFIX",EP_PRS_PREFIX)
|
220
|
|
widget_get_buf(EP_ASS_TOP,"EP_PRS_TITLE",EP_PRS_TITLE)
|
230
|
|
widget_get_buf(EP_ASS_TOP,"EP_PRS_USER",EP_PRS_USER)
|
240
|
|
widget_get_buf(EP_ASS_TOP,"EP_PRS_TEL",EP_PRS_TEL)
|
250
|
|
widget_get_buf(EP_ASS_TOP,"EP_PRS_FAX",EP_PRS_FAX)
|
260
|
|
widget_get_buf(EP_ASS_TOP,"EP_PRS_e-mail",EP_PRS_e-mail)
|
270
|
|
widget_get_buf(EP_ASS_TOP,"EP_PRS_STREET",EP_PRS_STREET)
|
280
|
|
widget_get_buf(EP_ASS_TOP,"EP_PRS_COUNTRY",EP_PRS_COUNTRY)
|
290
|
|
widget_get_buf(EP_ASS_TOP,"EP_PRS_CITY",EP_PRS_CITY)
|
300
|
|
widget_get_buf(EP_ASS_TOP,"EP_PRS_ZIP",EP_PRS_ZIP)
|
310
|
|
widget_get_buf(EP_ASS_TOP,"EP_PRS_FIRST",EP_PRS_FIRST)
|
320
|
|
EP_ASS_TOOLBOX/CreatePerson
(EP_PRS_PREFIX,EP_PRS_TITLE,EP_PRS_USER,
EP_PRS_FIRST,EP_PRS_TEL,EP_PRS_e-mail,EP_PRS_FAX,"","",
EP_PRS_STREET,EP_PRS_COUNTRY,EP_PRS_ZIP,EP_PRS_CITY,EP_USR_UIC)
|
330
|
C
|
-- Determine description text and create person
|
340
|
|
if (EP_PRS_FIRST == "")
|
350
|
|
|
EP_STRING = EP_PRS_USER
|
360
|
|
else
|
370
|
|
|
EP_STRING = strprint("%s, %s",EP_PRS_USER,EP_PRS_FIRST)
|
380
|
|
endif
|
390
|
|
EP_ASS_TOOLBOX/CreateResource(EP_USR_NAM,"USER",EP_STRING)
|
400
|
C
|
-- Commit transaction if no error occurred
|
410
|
|
end_transaction()
|
|