Applies to version 2017.1.x and newer; Author: Karol Wożniak
In older versions of WEBCON BPS, the operations on external and internal data sources were enclosed in a relatively simple mechanism. In order to use the information stored in the database or available through external services (e.g. REST API) we used to create a dedicated data source for each of these operations.
This approach is very easy to understand and simple to use, however it doesn’t adhere to good practices of reusability and non-duplication of similar entities in the program. Additionally, this can massively inflate the number of source configurations, which makes them a chore to manage them in big environments.
The keep things organized, we will divide data source configurations into the actual source configuration, and a so called Connection. Connection is in fact a method of connecting (server/URL/resource, login and password) to a specific source, while the data source definition itself is used to specify what data we wish to obtain from the data source.
Thanks to this logic, we define the connection once, and can use it for multiple data source definitions. If the connection parameters change, and we change the connection definition, all data source definitions using this connection will be updated. Each data source definition then has some method of filtering data (SQL query, CAML query, response configuration etc.) and one data source definition can be used for multiple form field configurations. Finally, data can be filtered further on each form field (e.g. via business rule filters).
The Data sources tab has two nodes with the following structure:
- Connections – facilitating the connection to external sources, i.e. MSSQL, Oracle, SOAP, REST, and SharePoint site collections.
- Data sources – configuring data obtained from data source, e.g. BPS internal view, Fixed values list, MSSQL database, Oracle database, SharePoint list, SOAP Web Service, REST Web Service, System, Custom (Plugins).
The ‘Connections’ node allows you to separately define connection strings for the most popular data sources.
Connection and data source configuration windows
With the connection parameters and data source definition being configured separately, here is what you need to know:
You can define the connection string/connection parameters and quickly check all places that employ the connection from this window.
The connection configuration fully supports the DEV/TEST/PROD mechanism, that’s why settings such as Server/Database/User/Password (for MSSQL/Oracle) can be defined simultaneously for each type of environment. The appropriate configuration for each environment will be used automatically, without needing to set them manually after moving to an environment.
The data source configuration will allow you to select a configured connection (make sure you save the connection definition, or it won’t be visible in the dropdown!), additionally, there is an option to choose the type of the testing environment (DEV/TEST/PROD/Common) to execute the testing request. The usages button will also show you all places where this data source connection is used.
Most data source connections will also have the option to employ some form of data filtration, this is the essence of each data source definition. For example: SharePoint lists will have a field to enter a CAML query, MSSQL databases have a SQL query field, BPS internal view fields have a wizard for selecting process data.
A new connection
In order to use an available data source in a form field configuration e.g. to power a choice field, the first step is to add the connection itself. It can be done by going to the “Data sources” tab in the Studio and choosing “New” for Connections e.g. MSSQL. Then it’s needed to input the correct connection values: Server, database and choose option “Windows integrated authentication” or provide user/password credentials.
These actions are visible on screenshots in the previous paragraph.
Using connections in data sources
The main difference is seen when trying to add more than one data source while using the same connection. Until now it was needed to input the connection settings each time, but now it’s possible to use those settings for any number of different sources.
Screenshot below shows a situation in which two different sources/requests are tied to the same database. Because they’re using the same source it is not needed to input database login settings each time.
Usage on the form
Using sources prepared in this way is no different than it was so far. So in order to use the given data i.e. in the choice field, you need to add a new form field, select its type, and choose the data source.
Choice field configuration is the same as in previous versions.
The Choice field window has a new function of choosing the connection of “Current BPS database” type. It can be useful, since allows you to execute all the queries to the main BPS database without creating and configuring a BPS internal view data source.
Similarly, if you have a MSSQL database connection defined, you can select it directly as the data source of a form field, and query it directly using the form field’s configuration – allowing you to skip defining a data source. There are scenarios when this is a good one-off solution, but in general, we encourage the creation of and reusing data source definitions
A simple example of configuration can be seen below.