Hi all. I'm confused about renaming worksheet columns and datasets. I would
like to rename a worksheet column to something based on user input during
button script execution. There seem to be a number of ways I can do this, but
each has problems.The most clumsy way is by switching the active window to the worksheet (in
this case data1), renaming the column, and changing back the active window to
what it was and where the button is (in this case, graph1):
win -a data1;
work -n 3 newname;
win -a graph1;
This isn't always suitable, since it maximizes the worksheet. Why is it
necessary to have the worksheet command only operate on the active worksheet?
Alternatively, it seems as though one could use the win -w command to execute
scripts temporarily considering the worksheet the active window:
win -w data1;
work -n 3 newname;
win -w graph1;
This simply doesn't work. I don't know why, although it isn't clear from the
Labtalk manual whether this is the correct format for this command. (Is the
second win -w command supposed to specify the original active window? Is
this all supposed to be executed within brackets?)
Using the set command seems as though it should be the best option. However,
this has been more troublesome. I used:
set data1_C -n data1_newname;
and was dismayed that the column name in the worksheet did not change. Then I
noticed that the dataset name (as listed in the layer n dialog box) was in
fact changed. However, going into the Plot Associations dialog for the layer
lists only the column names as they appear on the worksheet. So the same data
is now appearing in different places as having different names. Was a new
dataset created somehow? The other problem with this command for my purposes
is that it cannot be used to rename X columns.
I'll take any advice.
Tom