Skip to main content

Notice: This Wiki is now read only and edits are no longer possible. Please see: for the plan.

Jump to: navigation, search

Scout/Tutorial/5.0/webservices/Create Company Form

< Scout‎ | Tutorial‎ | 5.0

The Scout documentation has been moved to

Create Company Form

On the client node, go to Forms. Right click on the node to create the Company The Scout documentation has been moved to

Create Company Form

As the name of the form, enter Company and choose to create the Form ID which is the primary key of the company.

Create Company Form

Click next to choose from the artifacts which also should be created by Scout SDK.

Create Form artefacts

Uncheck all permissions as The Scout documentation has been moved to is not part of this tutorial.

Create Form Fields

On the CompanyForm node, go to the MainBox. Right click on the MainBox to create the following 9 Form The Scout documentation has been moved to's:

Create Form Field

Type: String Field
Name: Name
Class name: NameField

Set datatype for Form Field Set properties of Form Field

Type: String Field
Name: Symbol
Class name: SymbolField
Type: Date Field
Name: Trade time
Class name: TradeTimeField
Type: Double Field
Name: Value last
Class name: ValueLastField
Type: Double Field
Name: Value open
Class name: ValueOpenField
Type: Double Field
Name: Value low
Class name: ValueLowField
Type: Double Field
Name: Value high
Class name: ValueHighField
Type: Long Field
Name: Volume
Class name: VolumeField
Type: Double Field
Name: Change
Class name: ChangeField

Because ChangeField represents a procentual value, click on that field and check the property Percent in Scout Property View.

Set percent mode for the ChangeField

Furthermore, all stock quote specific fields have to be disabled as those fields cannot be modified because data is provided by a webservice. To to so, select all those fields in Scout SDK and uncheck Enabled in Scout Property View

Disable webservice specific fields

As the stock quote symbol can be maximal 5 characters long, this must be constrained on the SymbolField by selecting the field and set the Max Length property in Scout Property View to 5

Set maxLength to symbol field

Associate CompanyForm with CompanyTablePage

To edit and create companies, you have to add an EDIT and NEW menu to the CompanyTablePage. On client node, go to the node Desktop > Outlines > StandardOutline > Child Pages > CompanyTablePage > Table > Menus. Click on the menu node to create the following 2 menus:

Create menu on CompanyTablePage

NEW menu
Name: New company...
Class Name: NewCompanyMenu
Super Type: AbstractMenu
Form to start: CompanyForm
Form handler: NewHandler

Create the NEW menu

EDIT menu
Name: Edit company...
Class Name: EditCompanyMenu
Super Type: AbstractMenu
Form to start: CompanyForm
Form handler: ModifyHandler

Create the EDIT menu

In the EDIT menu action, we also have to provide the CompanyNr primary key as argument to the CompanyForm. For that reason, double click the EditCompanyMenu to modify the code in execAction() as follows:

protected void execAction() throws ProcessingException {
  CompanyForm form = new CompanyForm();
  // Add the following line to set the primary key of the selected company to the form
  if (form.isFormStored()) {

Load and persist company data

Scout SDK already created a CompanyService in order to load and persist company data. You only have to implement those operations:

For that reason, go to the server node and open the CompanyService by double click on Services > CompanyService.

Load and persist data in CompanyService

You will find the following method stubs:

 Is called by CompanyForm#NewHandler prior to open a non-existing company.
 This is if a company is to be created to show some default values in the form. It is not used by this tutorial.
 Is called by CompanyForm#NewHandler to create a company record in database
 Is called by CompanyForm#ModifyHandler to load a company record from database
 Is called CompanyForm#ModifyHandler to update a company record in database

Please implement those method stubs as following:

public class CompanyService extends AbstractService implements ICompanyService {
  public CompanyFormData prepareCreate(CompanyFormData formData) throws ProcessingException {
    // nop
    return formData;
  public CompanyFormData create(CompanyFormData formData) throws ProcessingException {
    SQL.insert("" +
        "           (COMPANY_NR, " +
        "            NAME, " +
        "            SYMBOL) " +
        "VALUES     (:companyNr, " +
        "            :name, " +
        "            :symbol)"
        , formData);
    return formData;
  public CompanyFormData load(CompanyFormData formData) throws ProcessingException {
    SQL.selectInto("" +
        "SELECT NAME, " +
        "       SYMBOL " +
        "FROM   COMPANY " +
        "WHERE  COMPANY_NR = :companyNr " +
        "INTO   :name, " +
        "       :symbol "
        , formData);
    return formData;
  public CompanyFormData store(CompanyFormData formData) throws ProcessingException {
    SQL.update("" +
        "UPDATE   COMPANY " +
        "SET      NAME = :name, " +
        "         SYMBOL = :symbol " +
        "WHERE    COMPANY_NR = :companyNr"
        , formData);
    return formData;

You can continue the webservices tutorial.

Back to the top