Order by syntax with structure

16 views
Skip to first unread message

Dale

unread,
Dec 20, 2015, 10:27:12 PM12/20/15
to Railo
I've created the below query result with a deserializejson function.
What is the "order by" syntax in a cfquery if I want to sort by the status, struct, value?

Thank you,

Dale

Query
Execution Time: 0.322 ms
Record Count: 1
Cached: No
Lazy: No
SQL:
SELECT *
FROM recordset2
 nameidtypedescriptionmodulestatuscreatedByserviceProviderCodeopenedDatetrackingIdcustomIdjobValuevalue
1ADAMS SEWERSANLEANDRO-DUB15-00000-00156
Struct
module
stringBuilding
value
stringBuilding/OTC/Residential Sewer/NA
type
stringOTC
text
stringResidential Sewer
group
stringBuilding
alias
stringResidential Sewer
subType
stringResidential Sewer
category
stringNA
id
stringBuilding-OTC-Residential.cSewer-NA
REPLACE SEWER LINE FROM HOUSE TO MAIN LOCATED AT REAR OF DWELLING.Building
Struct
value
stringIssued
text
stringIssued
CCUEROSANLEANDRO2015-07-31 00:00:00200767209B15-09888000DUB15-00000-00156
 

Peter Boughton

unread,
Dec 21, 2015, 8:13:04 AM12/21/15
to ra...@googlegroups.com
JSON doesn't know anything about queries, so deserializeJson would not be outputting a query (unless it has a bug).

Queries are designed to handle simple variables - whilst arrays/structs/queries can be stored inside query cells, I don't think there's any specific support for it in QoQ, and I doubt there's any SQL ORDER BY construct that'll handle it.

For a concrete answer, you'd want to either read through the source and figure it out, or ask a developer. Of course, all Railo developers (and community) switched across to Lucee (http://lucee.org) so you'll need to go ask on the Lucee mailing list, where Micha/Igal may be able to provide an answer.

Most likely the advice will be to either separate the struct keys out into separate query columns and sort on those, or just use an array/struct combo then do the sorting with ArraySort and a suitable comparison function.
Reply all
Reply to author
Forward
0 new messages