Query entity reversing the order of fields when retrieving objects of a Custom Data Type

When using a!queryEntity() to retrieve CDT objects from a table according to a filter, I have noticed that it reverses the order of columns/CDT fields.

Is there any way to prevent this? Why is this happening?

  Discussion posts and replies are publicly visible

Parents Reply Children
  • It doesn't return it as a list of CDT because it makes it more clear what information was returned by the query. For example, let's suppose you set up a query that returns only two fields: id and name, even though your source CDT had 20 fields. Then you cast the result to CDT and save this result as an expression rule. If I now use this rule inside of an interface or elsewhere in Appian, it will return the list of CDT with only ID and name returned. However, now it isn't as clear - did my query only return those two fields or are all the other fields null in the database?

    Returning a dictionary makes this simpler because now I know exactly what fields are returned from my query. Plus, as the previous poster mentioned, you can always cast the result to CDT if you need it.