Lucian,
actually, you do not need an external data source function at all. You need an external data source table with Expression in data source specified.
You can use this table in:
- Queries (specify the parameters after the table name in parentheses, comma-separated)
- Dynamic lists (use a custom dynamic list query that includes the parameter values)
When 1C:Enterprise generates a query to a data source, it fills the FROM section as follows:
- If the table type is Table: NameInDataSource
- If the table type is Expression in data source: ExpressionInDataSource
So, the entire expression that you specify goes to the FROM section of the query to the data source.
Example 1You create a table Table1 with columns Col1 and Col2. Its NameInDataSource is "MyTable1". The query that you specify in the platform is:
SELECT
T1.Col1,
T1.Col2
FROM
ExternalDataSource.ExternalDataSource1.Table.Table1 AS T1
The query to the data source is:
SELECT
T1.Col1,
T1.Col2
FROM
MyTable1 AS T1
Example 2The table's ExpressionInDataSource is "MyFunc1(&1, &2)".
The query that you specify in the platform is:
SELECT
T1.Col1,
T1.Col2
FROM
ExternalDataSource.ExternalDataSource1.Table.Table1(100, 67) AS T1
The query to the data source is:
SELECT
T1.Col1,
T1.Col2
FROM
MyFunc1(100, 67) AS T1
Example 3The table's ExpressionInDataSource is "(SELECT 100 AS Col1, 500 AS Col2 FROM DUAL)".
The query that you specify in the platform is:
SELECT
T1.Col1,
T1.Col2
FROM
ExternalDataSource.ExternalDataSource1.Table.Table1 AS T1
The query to the data source is:
SELECT
T1.Col1,
T1.Col2
FROM
(SELECT 100 AS Col1, 500 AS Col2 FROM DUAL) AS T1