0

In the AX client, is it possible to change the field order in a table, without dropping and recreating the table? Is there a quick and easy way to do it?

I am using Dynamics AX 2009.

I've tried:

  • In AX, changing the order of the fields in the table and saving the table. After the client is closed and reopened, the order of the fields returns to its original order.
  • In AX, syncing the table, then changing the order of the fields, then syncing the table, then reopening the client.
  • In the database (SQL Server using Management Studio), reordering the fields then: restarting the AOS, syncing from AX, etc.
Jan B. Kjeldsen
  • 17,817
  • 5
  • 32
  • 50
Michael Russ
  • 81
  • 3
  • 10
  • Why do you want to change the order is the better question. – esac Sep 20 '12 at 03:54
  • I'll try to answer: There can never be a good reason for this. Only if your job involves arranging shelves or something similar you would need to do this. (Got myself carried away a bit :)) – Bojan Milenkoski Sep 21 '12 at 14:25
  • 1
    I am working with a table that hasn't been released publicly, it is only in development. The reason for changing the field order is to have natural logical grouping of the fields for human readability and usability during development. The order fields are presented in is for human readability and usability, rather than function. Since AX already maintains metadata outside of the database for tables, it would make sense to have presentation order maintained in the metadata, independent of the physical data structure. However, based on the answers, that does not appear to be the case. – Michael Russ Sep 24 '12 at 15:37

2 Answers2

3

Fields are listed in fieldId order, which cannot be changed unless deleting the fields then recreating them (by import) in the "correct" order. This will of course delete any data contained in the table.

In AX 2012 the fields are always listed alphabetically thus voiding any fieldId order.

Don't waste your time: add the fields to the AutoReport field group. This is much more useful, as you can use the field group in a form grid and even in the table browser.

Jan B. Kjeldsen
  • 17,817
  • 5
  • 32
  • 50
  • I agree. The notion of having all the fields sorted in a specific order on the table is not worth while. It can only be explained by OCD. I am certainly not the only one to wonder why IncoiceId is a column so "late" in CustInvoiceJour, nevertheless it is. As pointed out, moving the columns around in a table where there is data will result in data loss. Be adviced! – Skaue Sep 20 '12 at 11:53
1

I don't know why you need, however if the table is empty you can:

  1. export the table, having the "Export with ID values" checkbox ticked
  2. delete the table
  3. modify the field Ids in the exported XPO file
  4. import the table, having the "Import with ID values" checkbox ticked

As a result the table fields in the AOT will be sorted by the field Ids

Technically the table will be dropped and recreated, but you won't need to recreate its structure and add all the fields manually.

10p
  • 5,488
  • 22
  • 30
  • This will not work as fields are listed in `fieldId` order and the `fieldId` is preserved by this procedure. In AX 2012 the fields are always listed alphabetically thus voiding any `fieldId` order. – Jan B. Kjeldsen Sep 20 '12 at 05:39
  • Jan - "fields are listed in `fieldId` order" - exactly, and the `fieldId` is not preserved by this procedure, see step 3. The question was about AX 2009. – 10p Sep 20 '12 at 09:51
  • Thanks 10p. Even though this answer does require recreating the table, it does provide a potential solution. I appreciate the help and marked this answer as useful accordingly. – Michael Russ Sep 24 '12 at 15:44