GetSQLValueFromSource returns a single value - being the first field in an aSQL query.
It is more common to use the function GetDataSetFromSource to return multiple values - this saves re-querying the database to retrieve multiple fields from a single record. Please also review GetDataSetFromSource.
The SQL query is executed against a DB Connection on the Source of the Map.
aDBIndex indicates which of the DB Connections is used based on its zero based index.
Declaration: function GetSQLValueFromSource(const aSQL: string; aDBIndex : integer): variant;
An example follows.
procedure OnMapEvent(var Value:Variant);
begin
Value := GetSQLValueFromSource('select name from dr_accs where accno=1',0);