Use different data sources to populate a table based on selection from a list

can I use the below code as the javascript to dynamically select a data source:

switch (FilteredBy.selectedIndex) {
case 2:
Q06();
break;
case 6:
Q07();
break;
default:
// Default case logic (if needed)
}

You can't set the data of table directly. The work around is set a variable, and set it as datasource of table, then you can set the default value to the selectedItem of list.

Hey @rameshkv! As @AnsonHwang mentioned, this can't be used in the table's Data source field. But you can definitely use a JS query to return the different data based off of a select component value.

You'll want to return the awaited call to each individual query in your JS query.

Then use that JS query as the Data source for the table.

Since columns are likely not the same, you can enable dynamic column settings and set the label to {{item}}.

Let me know if you have any follow up questions!