7

Is there a way to reorganize the fields/attributes in a data extension? I've added some extra fields that relate to other fields in that extension. I haven't found a way to regroup those fields.

2 Answers 2

7

It is impossible via the UI to change the order of the fields in a Data Extension unless you delete fields and add them again or utilize a SQL query to create a new DE with the correct field layout.

There is a way via the SOAP API to view the ordinal value of an existing Data Extension Field - which you can then look to update via an Update request to the DataExtension Object. This is the best option I have been able to find so far.

I have attempted this on my own without much success, but wanted to pass along what I know in case you are able to break through it.

To reiterate, there will be 2 steps:

  1. Retrieve Request to DataExtensionField Object to get the info for each field
  2. Update Request to DataExtension Object to update the ordinal values for each field.

Sample SOAP for Update Call:

<soapenv:Body>
        <UpdateRequest xmlns="http://exacttarget.com/wsdl/partnerAPI">
            <Options /> 
            <Objects xsi:type="ns1:DataExtension" xmlns:ns1="http://exacttarget.com/wsdl/partnerAPI">
                <CustomerKey>yourExternalKey</CustomerKey> 
                <Fields>
                    <Field>
                        <Name>yourField</Name> 
                        <Ordinal>2</Ordinal> 
                        <IsRequired>true</IsRequired> 
                    </Field>
                </Fields>
            </Objects>
        </UpdateRequest>
    </soapenv:Body>
2
  • 1
    This is very helpful. In short-term, might be easier to just create a new DataExtension, but I'll put this on the list of things to learn how to do. Mar 20, 2018 at 14:28
  • Yeah that is exactly what I wound up doing too. Its the simplest and quickest solution if your use case will allow it. Mar 20, 2018 at 14:32
4

If someone still searching (like me). I'm almost certain that is not possible without recreating the Data Extension.

I have tried with WSProxy (tried something similar to Ivan's code snippet). Even though, I got an "Ok" Status as response, the fields stayed the same.

I had opened a case and support told me that Ordinal property is not updatable through SOAP API (therefore, neither using WSProxy). It's possible to check If you make a describe call on the "DataExtensionField" object. Support also told me that:

" The “OK” message you are seeing means that the server received your request. The error is occuring after the API call is complete, so it does not get flagged by the call.

Ordinals are created at the same time as the Data Extension and are not meant to be updated as this could break the DE. If the ordinals on a Data Extension need to be changed, best practice would be to recreate that Data Extension. "

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .