Scripting with UDSBlock |
Top Previous Next |
Using DScript is done by using files with extension .uds ("Upscene Data Script") and starting the script with EXECUTE UDSBLOCK.
The script can have input and output parameters, as well as additional local variable, cursor or local routine declarations.
Here's an example:
execute udsblock (vc1 varchar(10)) returns(o1 integer) as declare variable b integer; begin b = 10; if (vc1 is null) then o1 = 1; else o1 = 2; end
Here's the block broken down into its sections, the first part tells us, this is a DScript block.
execute udsblock (vc1 varchar(10))
Next part, the optional input parameters, surrounded by parenthesis. The example includes a single input parameter.
execute udsblock (vc1 varchar(10) )
After that, you can include the optional return clause for one or more values, surrounded by parenthesis. The example includes a single output value.
returns (o1 integer)
There's room for optional declaration or variables, subroutines and cursors between AS and BEGIN.
as declare variable b integer; begin
Then comes the bulk of the script, inside the main BEGIN ... END block.
begin b = 10; if (vc1 is null) then o1 = 1; else o1 = 2; end
The language resembles SQL and its elements. There's a number of data manipulation statements, procedural statements and exception handling statements available as well as a large function library.
|