Share this page

# Work With External Data Sources

This task describes how to work with an external data source to import or export data.

In this topic:

## Add an external data source

You can associate a data rule with an external data source in order to import or export data.

In the Data Model Editor, select New Rule > Data Driven Rule.

Initially, you need to specify the data source type: Excel file or database

Select one of the following options:

Create new data source. The Service Virtualization Designer creates a new data source, structured according to the schema (message structure) associated with the virtual service. Rule columns are automatically bound to the data source columns.

Use existing data source. You must then manually bind rule columns to data source columns. After binding, the external data is imported to the Data Model.

For details, see New Data Driven Rule Dialog Box.

Result: A preview of your external data is displayed within the rule.

Note that the worksheets (for file-based data sources) or table (for databases) in the external file are displayed as tabs at the bottom of the data table.

Back to top

## Bind the data

If you selected an existing data source, you must bind the data. You create mappings between the data columns in the external data source, and the columns/headers in your data rule.

1. In a column header, click bind data. If it is not visible, click View Options > Data Binding.

   Headers must be expanded down to the lowest level in order to bind.

2. Click a column in the displayed external data source table to bind that column.
3. Repeat steps 1 and 2 for all columns you need to bind.
4. Click OK. The data is imported.

Back to top

## Bind array data

When the message structure contains an array that needs to be data-driven, you need to work with a properly structured data source. For an Excel file, it must contain database-like relationships, using primary and foreign keys, which allow the mapping of one row to many.

When binding an array item, the Edit Relations dialog box opens automatically, enabling you to define the relationships between tables that are required for array binding. For user interface details, see Edit Relations Dialog Box.

Alternatively, right-click the rule or column header and select External Data Properties. See the Relations area.

Back to top

## Bind other data

You can configure binding for working with different data formats (REST protocol), different response types (SOAP protocol), or a message structure containing different types.

When you start to bind to a data source column where the response can contain these types of data, the relevant dialog box opens automatically (The Data Format, Response Type, or Choice Data Binding dialog boxes). For user interface details, see Data Format/Response Type/Choice Binding Dialog Box.

Back to top

## Configure import/export settings

You can configure rules to import or export data, or configure settings for rules already associated with an external data source.

Learned Data rule | To export learned data, right-click the Learned Data rule and select Export Data.
Blank/custom rule | To import data from or export data to an external data file, right-click the rule and select Import Data or Export Data.
Data driven rule | For a rule already associated with an external file, you can change settings. Right-click the rule and select External Data Properties.

Back to top

## Refresh the data

If you have selected the Data Synchronization option for your rule, the data is automatically re-imported or exported.

Note: For synchronizing data with a virtual service deployed on a Service Virtualization Server, make sure that the external data file is stored in a network location accessible to the Server.

To manually refresh data, right-click the rule and select Refresh Data. The data is imported or exported, depending on how the rule is configured.

Back to top

## Change the properties of the data source

To change the properties, right-click the rule and select External Data Properties. You can change the path of the external data file, the connection string for the database, and several other properties based on the type of the data source.

Back to top

## Disconnect external data

To disconnect a rule from an external data source and remove bindings, right-click the rule and select Disconnect External Data.

Back to top

See also:

- Modify Virtual Service Behavior
- Data Driving
- External Data Properties Dialog Box

https://admhelp.microfocus.com Service Virtualization 8942
Tips to improve your search results... Service Virtualization Help Center SV Help 5.4-5.4.1 All View Local Help Center View Online Help Center back Go back in browser history forward Go forward in browser history Remove search highlights next topic Go to next topic previous topic Go to previous topic Print the current topic Version: