ColumnMap contains independent columns

Hi! o)

If you have a script, which creates a set of columns, which are setup to be of type "multicol" and which also creates some more columns, which are not "multicol", but "singlecol", so these use their own function, the map of columns passed for the multicol columns not only contains all multicol columns, but also the names of the singlecol columns.

I noticed that while further improving a column cache mechanism, which is completly generic and suddenly fails, because "singlecol" columns appear in a multicol set for which I have no data at hand. Data for a singlecol column is fetched in a separate function, which I cannot reach while the multicol set is being "stuffed", so they not only seem to make no sense there, they actually disturb.

You can try with this snippet, which prints all column names of a ScriptColumnData object. Run it in the OnColumn-Function for the multicols).

/////////////////////////////////////////////////////////////////////////// function GetColumnNames ( data ){ var colEnum = new Enumerator(data.columns); for (;!colEnum.atEnd(); colEnum.moveNext()){ var col = colEnum.item(); DOpus.Output("Colname: " + col); } }

Thanks! o)

I think this is by design. Your multi-col function gets a chance to fill in the details of all the columns, and if it doesn't then the single-col functions will be called to get them.

Other than having to check which column it is filling out (which the script has to do anyway), what problem does it cause?

Hi Leo, thanks for taking the time! o)

I actually never check what column to fill out for a multicol column set, I always just fill all the columns.
So I probably disagree a bit on your point, that a script always needs to check what column it is currently dealing with.

Problems caused:
It kind of prevents an attempt to easily cache values for just those columns, which are part of a multicol column set.
With the singlecol columns mixed in, I cannot determine what columns to retrieve from the cache, nor which columns to store there.

Look this easy piece of code, barely 4 lines and the cache is functional.

function Column_MultiColSet( data ){
var cachedItem = ColCache.DoTheCacheMagic(data);
if (!cachedItem.isModified && !cachedItem.isExpired)
return; //columns automatically filled from the cache, nothing more to do

//regular column code..
data.columns("Col-01").value = 10;
data.columns("Col-02").value = 20;

ColCache.SaveColumns( cachedItem, data); //saving column data for the current data(.item)


I actually see no reason, why the singlecol columns are mixed into the multicol map of columns.
If I wanted them to be there, I'd just set the multicol property on those. If I have no value for a specific column, I'd not set a value and the multicol-method will be invoked again for that specific column. The other way round, it seems you need to set the multicol property to true only on one column, to turn all other columns into multicol columns. Isn't that weird?

So now I need to add a second, redundant column initialization block for multicol column sets, just because the existing multicol-property has no effect. Alternatively to leaving out the singlecol columns, adding the method-property to all the columns in the map would also work, so there's a way to filter out multicol columns by their method-name e.g.

Excuse me, this is heavy stuff for christmas, but my calendar is finished. o))
Thx! o))

If your code always fills out certain columns, without checking what it was asked for, it shouldn't matter if there are extra columns in the map. Just ignore them, fill out the data for the columns you want to, and everything should work.

If your code looks at what's in the map to decide which data it needs to cache, then it's already looking at what's in the map and simply has to ignore the columns it doesn't want to provide data for via that method.

Am I missing something?