Sort Columns in a specific Order Ignition Perspective

I have a table with n number of columns.
Few of these columns have the Field and Title property in Words all other are Numbers. Now when i populate this table, the columns with Number comes first and the columns with Words go to the last. I want to show the columns with the Words before the Numbers. I am not using bind data or named query. Everything is setup by the Python Script.

I have defined the columns order in the Columns property of the Table.

When I execute the same query in the workbench the intended order came up.

Is there a way to apply the order I need?

Have you specified the query column name in each columns.x.field property?

Yes I have.

OK, I see what you meant (and wrote!) in the original post.

Perspective - Table | Ignition User Manual says,

  • 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 you're going to have to do some trickery.

  • Get the query to rename the columns using the AS function and add a leading alpha character.
  • Use those names in the columns.x.field properties.
  • Use the columns.x.header.title property to display just the number.
2 Likes

Thought of that, I thought maybe there is a way to define the custom order to put the columns.x.field with word before the numbers in ignition.

Anyways thanks. I will update the query.

No, I suspect that you've broken the table functionality by using a number in the data column name. If you're using JSON rather than a dataset the props editor won't even let you specify a value name beginning with a number.


Figure 1. Image source: JSON.org.

According to the image the key must be a string.

Ignition seems to tolerate incorrect JSON to some extent but the table can't make any sense of the columns if it's invalid. I don't know what happens with a dataset.

2 Likes

Oh I see, that's why it was working perfectly with the String field names and start behaving abnormally when I changed string to number. Thanks a lot for the in dept explanation.