Remote Query
Remote query defines how data will be retrieved from remote data source and how the remote will be used in Perfion. All remotes must have remote query.
Create New or Edit Existing Remote Query
There are two ways to create new or edit existing remote query: from the Administration top menu or from the “Feature Definition” window.
Create Remote Query from the Administration Top Menu
This is a standard way to create or edit any type of remote query. The procedure (refer to Figure 6):
Select Administration in the top menu and then choose Remote Queries.
The “Remote Queries” window will open. This window contains all remote queries.
Right click anywhere in the remote query list to open a context menu.
From the context menu select to create a new remote query or edit the selected remote query. In order to edit existing remote query one can also double click on selected remote query.
If options “Add” or “Edit” were selected, then the “Remote Query Setup” window will open.
Set up remote query. Refer to Remote Query Setup for more information.
Click “Save” and then close the “Remote Queries” window.
Create Remote Query from the “Feature Definition” Window
Remote query can also be created directly from “Feature Definition” window when assigning remote query to a feature in order to make it a remote feature. The procedure (refer to Figure 7):
Create a new feature or open an existing feature for editing from “Features” pane.
The “Feature Definition” window will open.
In the “Feature Definition” tab “Remote” area “Query” select box shows the selected remote query which is used with this feature. Here one can select an existing remote query and press “Edit” button or select an empty option and then press “New” button.
The “Remote Query Setup” window will open.
Set up remote query. Refer to Remote Query Setup for more information.
Click “Save” button.
At this point the new remote query was created or existing remote query was updated and one can continue setting up the feature.
Test, Default and Custom Modes
The remote can be used in four different modes which control where and how in Perfion they will be used.
Mode | Usage | Description |
Test (setup) | “Remote Query Setup” window | Test mode is used in order to test remote if it works using test parameters. It is recommended to set test mode so, that it will return only small amounts of data from remote source. This mode is activated when the “Test” button is pressed in “Remote Query Setup” window. |
Test (Headers only) | Remote feature data field selection (in “Feature Definition” window) | It uses test data like in Test (setup) mode, but the purpose of it is to retrieve only headers information from remote data. It is used from “Feature Definition” window when selecting remote data field. |
Default | Grid, “Item Editor” window Report Designer, etc. | Default mode is used everywhere in Perfion except two cases as described in Test (setup) and Test (headers only) modes. |
Custom | Report Designer etc. | This mode is the same as Default mode, but with custom parameters. In some cases in Perfion where remotes are used (e.g. Report Designer) it is possible to overwrite some of parameters for remote with custom parameter values. In this case the parameters specified in Select Statement and/or Setup XML will be overwritten with those custom parameter values coming e.g. from the Report Designer. For more information how to use such parameter refer to the manual “Perfion Parameters”. |
Remote Query Setup
All remote query configurations are done from “Remote Query Setup” window. Overview of parameters (refer to Figure 8):
Name. Remote query name.
Remote Connection. Connection which is used to get access to remote data. Remote connection specifies all parameters needed in order to connect to remote data source. It will determine which type of remote data source will be used (Database, OData or Web Service) which will also affect the layout of Remote Query Setup window. Note that Web Service type remotes do not have Select Statement window and requires Setup XML data, while remotes which have other data sources (Database or OData) use Select Statement and Setup XML is optional.
Select Statement. In this window one can specify SQL query (for Database remotes) or OData query (for OData remotes). Web Service remotes do not use this window.
Remote Query Type. Remote query type selector which allows to define if remote query will be of Single or Cluster type.
Setup XML. XML document, which allows specifying various parameters for remote query.
Test data preview window. This window is used to show preview of remote data returned for remote query when using test mode. It is hidden at first and is shown only after executing data retrieval test which can be done by pressing the “Test” button or F5 button on the keyboard.
Setup XML template. This is a button which when pressed will insert the template of fully configured Setup XML document with all parameter types.
Query Name
Remote query name is unique name to identify the remote query. We recommend to specify a name, which would explain what type of remote query it is, e.g. what type of remote data it will retrieve.
Remote Connection
Remote connection will specify all parameters needed in order to connect to remote data source. One can select one of available remote connections or create a new one.
To create a new or to edit existing remote connection (refer to Figure 8):
Open remote connection select box and choose a blank field or existing remote connection.
If the existing remote connection is chosen, then press “Edit” button to modify and if the blank field was selected, then press the “New” button to create a new remote connection.
“Remote Connection Setup” window will open.
Edit or define a new remote connection name. The name should be unique and we recommend to use names, which describe the connection. Note that the same connection can be use not just for remote queries, but also in other places in Perfion, e.g. Actions and in such case the remote connection name will be used as identifier for remote connection.
Specify the remote connection information in Connection Info text box. The remote connection type will be determined based on how the data was specified. Refer to Remote Connection Type.
If it is an URL, then the remote connection will be of Web Service type.
If the data starts with “Provider="OData"”, then the remote connection will be of OData type.
If none of the above were detected, then remote connection will be of Database type.
If no data is provided
Click “Save”.
The type of remote connection will be defined based on remote connection type. If, for example, one uses web service URL as connection, then remote will become web service type remote. Connections for different data sources are specified using different specifications and Perfion will detect which one is used to define the remote type. Refer to remote query setups for different data sources to see remote connection specifications.
Remote Connection Type
Remote connection type will be determined based on what data is provided in “Connection Info” field in Remote Connection Setup window.
If it is an URL, then the remote connection will be of Web Service type.
If the text starts with “Provider="OData"”, then the remote connection will be of OData type.
If none of the above were detected, then remote connection will be of Database type.
If the “Connection Info” field is left empty, then it will be a Database connection to Perfion database.
Remote Connection Templates
To make it easier to define the remote connection one can click the right mouse button inside the Connection Info field to activate the context menu from which one can select various connection templates. The templates are predefined to reflect various supported types of configurations which could be used in Perfion. The template after it is inserted has to be updated by replacing placeholder fields (which start with “<” and end with “>”) with actual data. Refer to Figure 9.
Create Remote Connection from the Administration Top Menu
One can create a new remote connection from the Administration top menu. The procedure:
Select Administration in the top menu and then choose Remote Connections.
The “Remote Connections” window will open. This window contains all remote connections.
Right click anywhere in the remote connections list to open a context menu.
From the context menu select to create a new remote connection or to edit the selected remote connection. In order to edit existing remote connection one can also double click on selected remote connection.
If options “Add” or “Edit” were selected, then the “Remote Connection Setup” window will open.
Set up remote connection.
Click “Save” and then close the “Remote Connections” window.
Remote Query Type
The select box controls the type of data Perfion expects from remote data source. If the “Cluster” type is selected, then remote query will be expected to use variant data.
The expected remote type can be also defined in the Setup XML using the attribute “type”. However, the information provided in Setup XML is optional and is only used to support special cases, e.g. when using Web Service type remotes. In any case the select box will have priority and in case the types do not match, Perfion will overwrite the value in Setup XML to have the same value as defined in “Remote Query Type” select box.
Select Statement
Select statement window allows to define the query to be used for data retrieval. For database remotes one can define SQL query in this window, while for OData remote – OData query.
The Select Statement window is not used for Web Service remotes, because all the configurations are made in the Setup XML. The Select Statement window will be automatically hidden after a Web Service type remote connection is chosen.
The query defined in this window in most cases will be a standard query with an extra Perfion controls added to make query usable in different scenarios. For example, in order to use the same query in the grid and in Item Editor, the different amounts of data have to be retrieved using the same query. To control the amount of data, Perfion needs to know which data columns from remote are the key columns, which data columns are the variant columns, etc.
Users can also specify extra parameters, which allows controlling retrieved data more precisely for each scenario where data may be used in Perfion application. For example, users can specify available languages as a custom parameter, so data can be customized to retrieve data based on e.g. languages to create localizable remote feature, which returns data in several languages per each item.
Select Statement – Parameters
Select statement parameters can be of various types, but the rules are almost the same for all type of parameters. The differences will be only in how they are used, e.g. which keywords are used to distinguish one from another.
The parameter format |
#<parameter>[:<parameter values>]# |
There are several types of parameters:
Type | Format | Example | Description |
Key feature | #<Key feature ID># | #101# | This is a special parameter to detect key feature ID. In this case the parameter does not have name, but instead integer number >= 0. In example, key feature ID is equal to 101. This type of parameter is allowed only once in select statement, unless exactly the same parameter (with the same key feature ID value) is repeated multiple times. |
Variable | #@<parameter name># | #@ID# | This is a normal parameter. The parameter name can be chosen by user, but there are also some parameter names, which are reserved by Perfion for special use. Reserved keywords:
Note that parameter names are case insensitive. |
Perfion.In(<query parameter name>, #<parameter name>#) or Perfion.In(<query parameter name>, <parameter values>) | Perfion.In(ID,#@ID:2,3#) or Perfion.In(ID,1,2,3) or Perfion.In(ID,’1’,’2’,’3’) | The parameter is used only with OData query. Perfion.In is like a function, which takes two parameters as arguments. The first one (query parameter name) is used to identify entity name in OData source data and the second one is Perfion parameter or comma separated list of parameter values. Refer to Perfion.In Block for more information. |
Parameter values are optional. If parameter values are defined, then the values will be valid for all modes (Test, Default and Custom), but some values can be automatically overwritten by Perfion or by configuration, e.g. by Report Designer in Custom mode. Moreover, if Setup XML is defined and has parameter with the same name as in Select Statement, then parameter values from Setup XML will be used instead (in most cases, but there are exceptions, e.g. with key feature).
Parameter values can be of several types:
Parameter value type | Parameters | Example | After evaluation (Test mode) | Description |
No value | #@# | #@:1,2,3# | 1=0 or 1=1 | All parameters may be used without values, but headers only breaker parameter is not considered as a real parameter and has no values. The values can be defined, but they will be ignored. |
#@LANGUAGES()# | #@LANGUAGES(Name_)# | Name_EN,Name_DE | This parameter values will be ignored if defined. The parameter is special, because it will use multiple values, but these values will come from @LANGUAGES parameter instead. | |
Single value | #@REPLACE# | #@REPLACE:1,2,3# | 1,2,3 | Most parameters can be specified with a single value, but only @REPLACE type parameter can be specified with a single value only. Everything defined after the colon (:) will be treated as a single value. |
Multiple values | All other | #@ID:1,2,3# | 1,2,3 | All parameters, which are not as defined by “No value” or “Single value” may have multiple values. Values are comma separated and can be used with single quotes or without. All parameter values after processing will be escaped with single quotes if at least one value is not of numeric type. |
#@ID:1,2,3a# | ‘1’,’2’,’3a’ | |||
#@ID:’1’,’2’,’3’# | ‘1’,’2’,’3’ |
Perfion parameters in Select Statement are just placeholders, which will be replaced with actual values when Select Statement is evaluated. All Select Statement parameters with multiple values will become a list of comma separated values after evaluation. The table below shows examples of various cases how parameters are defined and how they will look after evaluation when used in different modes. The values are shown taking into account that Setup XML is not used, e.g. not defined or if defined, then has no matching values.