I have a mechanism I've used in the past for getting single-result data from an SQL backend:
Code:
Global_Variable Handle ghoSQLManager giConnection
Object oSQLHandler is a cSQLHandleManager
Move Self to ghoSQLManager
End_Object
// Or alternaively:
//Get Create (RefClass(cSQLHandleManager)) to ghoSQLManager
Function SingleValSQLCall Global Integer iTable String sSQL Returns String
Integer iRes
Handle hDB hStmt
String sRetVal
Open iTable
Get SQLFileConnect of ghoSQLManager iTable to hDB
Get SQLOpen of hDB to hStmt
Send SQLExecDirect of hStmt sSQL
Get SQLFetch of hStmt to iRes
If (iRes > 0) ; // Have a result
Get SQLColumnValue of hStmt 1 to sRetVal
Send SQLClose of hStmt
Send SQLDisconnect of hDB
Function_Return sRetVal
End_Function
I've just tested it in 19.1 and it works no problem.
In 20.1, the line:
Code:
Move (SingleValSQLCall(DeliverAddresses.File_Number, ;
("Select Count(*) From DeliverAddresses Where Customer =" * Customers.ID))) to sDelAdds // <-- error on this line
// Get SingleValSQLCall DeliverAddresses.File_Number ;
// ("Select Count(*) From DeliverAddresses Where Customer =" * Customers.ID) to sDelAdds // <-- or error in this line
(The commented out line was the original - I was just trying variations to see if I could get past the error.)
Throws the error:
Code:
----Compiler Error Summary----
- Error 14: C:\Projects\Innovation2\DDSrc\cCustomersDataDictionary.dd (ln 51) Please enter a number
Am I missing something? It seems to be saying that a function with a signature of Integer, String wants a number. 
Mike