Using a table or view as a record source is straightforward. You select a table or view from the Data Table list and click Apply. This example shows how to change tables at runtime.
To use a table or view as a record source:
FUNCTION
GenerateTableList()
INT iIndex;
STRING sItemName;
iIndex = 0;
WHILE iIndex < 6 DO
SELECT CASE iIndex
CASE 0
sItemName = "Employees";
CASE 1
sItemName = "Orders";
CASE 2
sItemName = "Customers";
CASE 3
sItemName = "Categories";
CASE 4
sItemName = "Products";
CASE 5
sItemName = "Order Details";
END SELECT
_OBJECT CallMethod(ObjectByName("AN36"),
"AddItem", sItemName, iIndex);
iIndex = iIndex + 1;
END
END
FUNCTION RECIPE_AN36_Click(OBJECT this)
STRING sTableName;
sTableName = _ObjectGetProperty(This, "Text");
IF (sTableName > "") THEN
_ObjectSetProperty(ObjectByName("AN35"), "RecordSource1", sTableName);
END
END
GenerateTableList();