Skip to main content

tdDoSQLRecords

Structure

tdDoSQLRecords(iDataSet, sSQL)

Type

Function

Description

This function will execute sql on one of three temporary datasets that exists in IndySoft solely for the purpose of running custom script sql. These datasets can then be looped and read, as needed, from other 'td*' custom rule functions.

Parameters

iDataSet=# of dataset, must be 1-10. IndySoft provides 10 datasets that can be accessed through 'td*' custom script functions.

sSQL= the sql to be run against the temporary dataset.

Example

if tdDoSQLRecords(1, 'SELECT COMPANY_NAME FROM COMPANY ORDER BY COMPANY_NAME') then
tdFirst(1)
while (tdEOF(1) = '0')
sCompanyName = tdFieldbyNameAsString(1, 'COMPANY_NAME')
iCount = 0
if tdDoSQLRecords(2, 'SELECT COUNT(*) AS COUNTER FROM GAGES WHERE COMPANY = '' & sCompanyName & ''') then
iCount = tdFieldbyNameAsInteger(2, 'COUNTER')
End If
ShowMessage('Company: ' & sCompanyName & Chr(13) &
'Gage Count: ' & IntToStr(iCount))
tdNext(1)
End While
End If