SetServerServiceClasses method (DataWindows)
Description
Tells the server component to trigger custom events defined
in user objects for data validation. These user objects, referred
to as service classes, must be defined in the PBL or
PBD containing the DataWindow object for the server component.
Controls
DataWindow type |
Method applies to |
---|---|
Web |
Server component |
Syntax
[Web DataWindow server component]
1 |
short <span>dwcomponent</span>.<span>SetServerServiceClasses</span> ( string <span>serviceclassnames</span> ) |
Argument |
Description |
---|---|
dwcomponent |
A reference to a Web DataWindow server |
serviceclassnames |
A string whose value is a list of PowerBuilder |
Return Values
Returns 1 if it succeeds and –1 if a specified service
class does not exist.
Usage
The main use of service classes is to provide data validation
using server-side business logic.
Service classes implement one or more user-defined events
with these names and signatures:
1 |
long dberror ( long sqldbcode, string sqlerrtext, string sqlsyntax, dwbuffer buffer, long row, datastore ds )long retrievestart ( datastore ds )long retrieveend ( long rowcount, datastore ds )long sqlpreview ( sqlpreviewfunction request, sqlpreviewtype sqltype, string sqlsyntax, dwbuffer buffer, long row, datastore ds )long updatestart ( datastore ds )long updateend ( long rowsinserted, long rowsupdated, long rowsdeleted, datastore ds )long htmlcontextapplied ( string action, datastore ds ) |
The custom events can use the same return codes as the corresponding standard
DataWindow events documented in Chapter 8, “DataWindow Events.” By setting a return code, a custom
event can cause the event action to be canceled in the server component.
When the standard DataWindow event occurs in the server component,
the component triggers the custom event in each of the listed service
classes. One or more of the components can implement the event.
A service class only needs to implement the events whose outcome
it wants to influence. Any of the service classes can set an event
return code that cancels the event action in the server component.
Instantiated service objects run in the same objects space
as the server component. If a runtime error occurs in the service
object, it could cause HTML generation to fail.
For information about using the Web DataWindow, see the DataWindow Programmers
Guide.
Examples
This JavaScript example for a server-side script
specifies a list of service classes that implement events:
1 |
dwMine.<span>SetServerServiceClasses</span>( |
1 |
"uo_update;uo_retrieve;uo_dberror" ); |