Thread Details

 Columns out of order


Post by Mark Levy
Joined 5/09/2019
Posted 7/26/2019 1:47 PM

Often when I execute a query the columns are displayed and exported out of order from the order I queried them. Seems like a bug and has been very annoying.

Post by Administrator
Visual Software Systems
Joined 1/01/2016
Posted 7/26/2019 2:02 PM

Hi Mark,

Does this happen with every query execution or is it random?  We tried to replicate this but so far haven’t been able to. Do you have a query you could send us that will illustrate the issue?

Post by Mark Levy
Joined 5/09/2019
Posted 7/26/2019 3:53 PM

Difficult to send a query to replicate as we have custom objects we're querying off of that causes this to happen.

I wonder if this happens perhaps when trying to query for related object items, eg. a query that contains "RelatedObject__r.EvenFurtherRelatedObject__r.RelatedObjectField__c" and "RelatedObject__r.RelatedObjectField__c" and finally "ThisObjectField__c" as columns

 

example query that actually produced this issue:

SELECT Billing__r.Customer__r.Account_ID__c,Billing__r.Customer__r.Name,Product__r.ProductCode, Total__c FROM Billing_Line__c

The results show in column order: Account ID, ProductCode, Total, Account Name (account name is out of order, should be the second column)

 

Post by Administrator
Visual Software Systems
Joined 1/01/2016
Posted 7/26/2019 4:04 PM

Thanks Mark. This should help us determine where things are going wrong.   

Post by Administrator
Visual Software Systems
Joined 1/01/2016
Solved
Posted 8/12/2019 4:41 PM

Hi Mark,

This issue is corrected in the latest maintenance release, 2019.1.276.  There is one situation where the columns will still be presented in a different order than what was specified in the select statement.  When selecting multiple fields from a parent relationship, they will always be grouped and presented together, in the order they were specified in the query.  So if you have the query "select id, name, account.name, amount, account.annualrevenue from opportunity", the fields will be returned from Salesforce as follows: id, name, account.name, account.annualrevenue, amount.

Post by Ibad Rahman
Joined 6/14/2018
Posted 2/07/2020 10:08 AM

If the columns could be made exactly i the order specified in the query regardless of circumstance it would be helpful.

Post by Administrator
Visual Software Systems
Joined 1/01/2016
Posted 2/07/2020 3:06 PM

Yes, agreed and we are looking at ways to do that. Right now we are limited to ordering columns the way they are returned by Salesforce. 

Log in to reply to this post.