Perspective table columns in unpredictable order

I have a perspective table in which the property 'data' is assigned the following binding script:

cols = ["A","B","C"]
rows = [[10, 20, 30]]		
return system.dataset.toDataSet(cols, rows)

The Table doesn't have any other property customized, in particular it doesn't have the columns array property assigned.
What I get is:
image

Now, let's shuffle the columns order:

cols = ["B","C","A"]
rows = [[20, 30, 10]]		
return system.dataset.toDataSet(cols, rows)

image

The table seems to keep the column order provided in the dataset.
Now let's add another column:

cols = ["B","C","A", "10"]
rows = [[20, 30, 10, 40]]		
return system.dataset.toDataSet(cols, rows)

image

When the column name is a string that can be converted into a number, it goes at the beginning. Please don't say that the numbers come before letters because this would be if an ordering was going on, and that is not the case as I showed in my second example.
This is relevant for my application because I'm generating a pivot that uses both numbers and strings as columns headers. As shown in my example, they are all handled as strings.

It seems to be a minor inconsistency in perspective's table component but it forces me to populate the columns list dinamically instead of using automatic columns generation.

Have you set the table's column.X.field properties to match the cols names? Doing this will force the column order.

As I mentioned, I'm not setting the columns. I'm exploiting the auto-generated columns.

In Perspective - Table | Ignition User Manual the columns property states,

field : A string that matches this column config with a table column. This string must correspond to the default column name of the column. Value is string.

I think it's a bug. Even if I set all the column.X.field properties and specify an expression "10" to force it to a string (indicated by green value color) the sort order is incorrect.

I suggest you contact support.

1 Like

i mean you should never name a column after a number, that makes no sense

2 Likes

but if it is a Pivot

you mean making your headers in the first column instead of the first row?
whats a real example? (something that makes more sanse than ABC10)

1 Like