GP SoftwareTwitter
Opus FAQsManualCommandsObjects

Refreshing a custom column settings


When updating a column as described RefreshColumn some settings I.E. header, type, width are not updated. Is there a way to force an update? Or is removing and re-adding require for some settings?

Can be tested using the Column - Custom Text and Regexp columns. Add new column, display in Lister, update header.

Requested here Column - Custom Text and Regexp



I think right now it requires removing and re-adding the column to update the heading. The assumption was column names would not change outside of (early) script development, but we hadn't envisaged scripts with editable column names.

You could probably make the script loop through all the listers and their tabs looking for any with the column and replacing it. Problem might be to find a way to only do that when needed, and not every time the script loads.

We might be able to make it happen automatically on our side. I haven't looked at the code to see if there's any issue there, but it seems like something we should be able to do.


Although you said you might be able to do it internally. I decided to give it a try in the script doing the remove and add, however I have not been able to get it to work.
From the doco the command to remove a column should be Set COLUMNSREMOVE=Size which works for a standard column. However I could not get this to work for a custom column.
I think the command should be Set COLUMNSREMOVE=scp:RegExp Columns/RegExptest1.

I suspect the issue is the name is not correct. I tried a few combinations but not luck.

This is the function

function RefreshColumn(oldName, newName)
  	LogMessage("RefreshColumn: oldName:" + oldName + "  newName:" + newName);
  	var columnOldUniqueName = "scp:" + scriptName + "/" +  oldName;
  	var columnNewUniqueName = "scp:" + scriptName + "/" +  newName;
   	LogDebugMessage("DOpus.listers.count = " + DOpus.listers.count);
	for (var iLister = 0; iLister< DOpus.listers.count; iLister++) {
		var lister = DOpus.listers(iLister);
		LogDebugMessage("RefreshColumn: lister:" + lister.title);

  		for (var iTabs = 0; iTabs< lister.tabs.count; iTabs++) {
			var tab = lister.tabs(iTabs);
			LogDebugMessage("RefreshColumn: tab:" + tab.label);
  	  		for (var iColumns = 0; iColumns< tab.format.columns.count; iColumns++) {
				var column = tab.format.columns(iColumns);
				LogMessage("RefreshColumn: column:" +;
				if( == columnOldUniqueName){
					LogMessage("RefreshColumn: match:" +;
					var doCmd = DOpus.NewCommand;
					doCmd.RunCommand("Set COLUMNSREMOVE=" + columnOldUniqueName);
					doCmd.RunCommand("Set COLUMNSADD " + columnNewUniqueName + "(" + iColumns +")");

And script
RegExpColumns.js.txt (33.9 KB)


Got quotes around the script column names? I don't see them.. o)


Rule #1 in information technology, no blanks in identifiers. o)


Ah yes right you are.
I did try quotes around, but only single quotes. Double quotes got the job done.


Yep that worked, thanks @Leo