List the datasources of a query object

Here is how you can make a list of datasources from a query object.

 Query                query;
QueryBuildDataSource qbds;
Counter              child;
List                 listDataSources = new List(types::Class); 
ListEnumerator       le;
; 
query = new Query(QueryStr(CustBillOfExchangeJourUpdate)); 
for (child = 1; child <= query.dataSourceCount(); child++)
{ 
    listDataSources.addEnd(query.dataSourceNo(child));
} 
le = listDataSources.getEnumerator(); 
while (le.moveNext())
{ 
    qbds = le.current(); 
    info (TableId2Name(qbds.table()));
}

This posting is provided "AS IS" with no warranties, and confers no rights.
Use of included script samples are subject to the terms specified at https://www.microsoft.com/info/cpyright.htm