Loading a table with this function immediately sets the table.active but there are no fields loaded, so any fieldbyname() after filling raizes an exception at least in my tests. My workaround then was to load all fields before and then fill it. Any other way?
Is there a way to test if a table component used for DASQL is kind of “empty” before any use? Testing for empty fieldlist or else ?
I worked through this example already before, but just found my error:
Before loading a SQL with a different set of fields table.fields have to cleared first.
My first SQL had only field selected, next one had ‘select * from …’ but the additional fields were not loaded. With clearing tbale.fields before loading everything is fine.
And the testing for empty fields works well for my purpose.
if you change SQL, you should clear fields.
Recently (a month ago) we have changed behavior for DA SQL tables so you can use predefined lookup/calculates fields with DA SQL.
if table.fields aren’t empty, RDA doesn’t load schema for table. if fields are empty - it loads schema for DA SQL request.