Skip to main content

GetDataFromSource

procedure GetDataFromSource(const aDataSet: TvxClientDataSet;
const aSQL: string);

Example

procedure ScriptEvent(var Value: variant);
begin
GetDataFromSource(Data,
'select MessageID, ReceivedAt from ExampleInbound where ReadFlag = 0');
Value := Data.RecordCount;
end;

Usage

GetDataFromSource opens SQL into a client dataset using the primary source database connection.

Parameters

NameTypeDescription
aDataSetTvxClientDataSetMutable client dataset to close, clear, rebind and open.
aSQLstring, constQuery SQL for source index 0; parameter recognition is disabled.

Returns

No status. Success leaves an active cursor; no rows is not an error.

Errors

Index, connection and SQL exceptions are logged with script and SQL context and then suppressed. An unsuccessful procedure can leave the reset dataset inactive; consult logs.

Security and safety

SQL is direct and logged. Validate values instead of concatenating external text and limit result size. The synchronous call can wait on the external source and the live objects must not be reused concurrently.

Additional Technical Info

GetDataFromSource opens query SQL from the active map's primary source connection into an existing client dataset. It is an exact wrapper for GetDataSetFromSource(aDataSet, aSQL, 0).

The example is fictional, source-reviewed and not executed.

Implementation and side effects

The terminal method closes and clears the caller dataset, disables parameters, assigns FSource.DBCons[0].DBCon.SQLDATA, sets/logs the command and opens it. The old cursor/schema/edit state is destroyed. It has no explicit transaction-start or completion call.

Related entries

External references

Created 2026-07-15