Hello,
I am attempting to script a dialog window that prompts the user to select 2 data tables from a pair of list boxes that display all currently open table names. The dialog window, list box, and selection process all work as intended however once I have the 2 selected table names as variables I hit a road block when trying to associate them to data table references. The data table references are needed to perform work on the selected tables later in the code.
Issues arrise at the last two lines with the following error for dt1.
Argument must contain data table reference in access or evaluation of 'Current Data Table' , Current Data Table/*###*/(SourceData)
I realize that SourceData and TargetData are list objects with only 1 item each so I tried converting to string before associating as a data table name but that didn't work.
Any help is greatly appreciated. Please refer to script section below.
openTables = {};
For (t=1, t<=NTable(), t++, InsertInto(openTables, DataTable(t) << GetName));
SelectDataWindow = New Window( "Select data tables", <<Modal,
SourcePanel = Panel Box("Source Data Table",
SourceListBox = List Box(openTables, Max Selected(1))),
TargetPanel = Panel Box("Target Data Table",
TargetListBox = List Box(openTables, Max Selected(1))),
Line Up Box(NCol(2), Button Box("Ok",
SourceData = SourceListBox << GetSelected;
TargetData = TargetListBox << GetSelected),
Button Box("Cancel", Stop()))
);
dt1 = CurrentDataTable(SourceData);
dt2 = CurrentDataTable(TargetData);