Visual Composer provides a wizard that enables you to model a service component and add data and input ports to it.
This may be useful if you are modeling an application and the services you need to use do not yet exist in the back-end system. In this way, you can model the application, and then later replace the service created by the wizard with the real back-end service when it exists.
You can also use the wizard to create a mock-up of a service, so that you can show a service developer the requirements of the data service that you want them to create. The wizard also assists you in creating a service component that you can use when creating a demo application. Since the wizard enables you to add static data to the service component, you can create a model that actually works at runtime, and use it for demos.
When using the wizard to create a service component, you can click Finish at any point to create the service component – you do not need to complete all the steps of the wizard. After you create a service component (with or without the wizard), you cannot modify its data or definitions using the wizard. If you want to modify a service component, you need to manually modify its elements individually in the Design board.
If you want to create a service component to reuse within a specific model, the model in which you want to reuse the service component has been opened.
1. Perform one of the following:
a. From the Compose task panel, drag the Service Component icon to the Design board. From the context menu, choose Use Wizard. The Service Component Wizard is displayed.
b. Choose Tools ® Service Component Wizard. The Service Component Wizard is displayed.
2. In the Define Service Name page:
a. Enter a name for the service component.
b. If you opened the wizard by dragging the Service Component icon to the Design board, the new service component will be created in the development component of the currently opened model. If you opened the wizard using the Tools menu:
i. From the Repository dropdown list, choose the repository type in which to store the service component. You can choose from the following options:
§ Local Repository: Stores the service component in a local repository with no source control. Service components in the local repository can be accessed only by the user who created them.
§ Shared Repository: Stores the service component in a shared location where it can be accessed by other modelers. Service components saved in this location are managed using basic source control features (check in and check out). When you create a service component in the shared repository, it is automatically checked out to you that so you can start working on it. This option is available only if you do not have a source control system installed and configured for use with Visual Composer.
§ <Other source control system>: Stores the service component in the selected source control system. This option is available only if you have a supported source control system installed and configured for Visual Composer.
ii. In the Software component field, choose the software component in which you want to save the service component.
You cannot create a new software component from within Visual Composer.
iii. In the Development component field, choose the location in which to save the service component. If there are no development components in the dropdown list, or if you want to create the model in a different development component, you can create one using the New button. More information: Creating a Model and Development Component.
iv. Click Next.
3. In the Define Data page, add static data for the service that will be output according to the conditions you define later:
a. Specify whether the first row of the data you want to add is a header row, by selecting the Header row checkbox.
b. Add data as follows:
§ Copy data from a supported spreadsheet application, such as Microsoft Excel, and paste it in the Data pane by clicking the Paste from Clipboard button or pressing Ctrl+V.
You can also paste data from a text editor, as long as each field is separated by a tab character, and each record is separated by a newline character.
§ Drag a data selection from a supported spreadsheet application, such as Microsoft Excel, and drop the selection in the Data pane.
The data selection is added to a static data connector (displayed in the Connectors pane of this wizard page).
c. Repeat the previous step to add more data as required.
Note the following:
● Each data selection is added to a new static data connector.
● The type of data in each row is defined by the data types in the first row.
● All subsequent data selections that are added must have the same format as the initial data selection that was added.
● You can delete static data connectors (and consequently, the data they contain) by selecting the relevant connector in the Connectors pane and clicking the Delete Connectors button or pressing the Delete key.
● The same header row is used for all subsequently added data. Even if you delete all the static data connectors, the header data remains.
● A blank row of data causes all data after the blank row to be added in a new static data connector.
d. Rename the static data connectors to give them more descriptive names, as required:
i. Select the connector to rename in the Connectors pane.
ii. Click the Rename Connector button or press F2 and enter a new name.
e. Click Next.
4. In the Define Input page, define the input ports for the service component and the types of data they can receive:
a. In the Input ports pane, click the Add Port button and choose the data type for the port from the dropdown list: Record or Record Set.
b. Click the Rename Port button or press F2 to enter a descriptive name for the port.
c. Add additional ports as required. You can select a port and click the Delete Port button or press the Delete key to delete it.
d. For each port, in the Fields pane, define the types of data that it can receive.
The options in the Fields pane are the same as in the Define Data dialog box. For more information, see Define Data Dialog Box in the Visual Composer Reference Guide.
e. Click Next.
5. In the Define Conditions page, define the guard condition for each static data connector:
a. Select the static data connector.
b. In the Guard Condition column, enter the condition according to which the data that the static data connector contains is output by the service component. You can either:
i. Enter a condition directly in the field.
ii. Click the fx button to define a condition using the Dynamic Expression Editor dialog box. For more information, see Defining Dynamic Expressions.
6. Click Finish.
If you opened the wizard by dragging the Service Component icon to the Design board, the new service componentis added to the currently open model. You can double-click the service component icon to open it in a new model tab.
If you opened the wizard using the Tools menu, the new service component is created in the specified development component and is opened in a new model tab.
The service component contains a Data In connector for each input port that you defined, a Static Data connector for each static data selection that you added, and a Data Out connector. Each of the Static Data connectors is connected to the Data Out connector using a data map line with the guard condition that you defined for it.
You can right-click each of the elements and choose Define Data to view or modify the data that you defined for each element using the wizard. You can modify the service component in the same way as you would modify any other service component (you cannot modify a service component using the wizard).