This documentation is for WSO2 Data Services Server 3.2.2. View documentation for the latest release.
Default Values Sample - Data Services Server 3.2.2 - WSO2 Documentation
Skip to end of metadata
Go to start of metadata

This example demonstrates how default values specified in the .dbs file of the data service will be used when specific values are not given for some fields. In the RDBMS Sample service, a default employee salary is specified as 1500 in the .dbs file as shown below.

<param defaultValue="1500" name="salary" ordinal="5" paramType="SCALAR" sqlType="DOUBLE" type="IN"/>

Therefore, when you use the "addEmployee" operation to add a new employee, if you do not specify an explicit salary value for the employee, the default salary will be added. For example, execute the "addEmployee" operation with the following parameter settings:

  • employeeNumber=6002;
  • lastName=Smith; 
  • firstName=John; 
  • [email protected]
  • Remove <xs:salary xmlns:xs=""></xs:salary> from the operation to make sure that a salary value is not added.

Now, when you execute the "addEmployee" operation, the result will be the following:

Note that the "salary" value is set to 1500. This is the default value for that field as specified in the .dbs file of the data service.

  • No labels