DataTables will display a collection (aka Table) in table format. So you would have to plug in the name of a collection or DataSource into the dataTable's Items property.
So if you have two DataSources "customers1" and "customer2", then you can create a comboBox (with multi-select turned off) or a listBox that has these values. You can do this one of two ways (that I know of):
1: Put something like this into your screen's OnVisible event to create a collection and then in your comboBox's Items property, plug in "myComboList" (without the quotes).
Clearcollect(myComboList,
Table(
{ListItem: "customers1"},
{ListItem: "customers2"},
)
)2: If you don't want to have to deal with an in-memory collection, in the comboBox's Items list, simply plug in:
Table(
{ListItem: "customers1"},
{ListItem: "customers2"},
)
In the DataTable's Items property, you can put "yourComboList.Selected.ListItem" (without the quotes). The problem I've found with dataTables is that it, like a dataForm, expects a static set of columns. That is, customers1 has a column "Full Name" and customers2 has two columns "First Name" and "Last Name", the dataTable will orient itself to the initial DataSet (let's say for eaxmple customers1) and throw a fit when you try to dynamically set it to customers2.
I hope others will chime in (to my benefit as well), but the only way I can see doing this is by throwing in some design magic. You would add columns where needed and then use ShowColumns to filter out columns that were different.:
ClearCollect(myCustomCollection1,
ShowColumns(customers1
"FullName", "address", ...
)
);
ClearCollect(myCustomCollection2,
ShowColumns(
AddColumns(customers2,
"fullName", firstName & ", " & lastName,
...
),
"FullName", "address", ...
)
DataSet customers1 uses its original/native name of "fullName", while customers2 has a column added for "fullName" and then a ShowColumns command filters out the no-longer-used firstName and lastName.
Now, using the example above regarding the comboBoxes, you can set your comboBox's choices to include "myCustomCollection1" and "myCustomCollection2". Now when you select the custom collections, the table will update dynamically using the standardized column names. I hope that helps.