OrderBy in the CAML?

Forums Autocomplete OrderBy in the CAML?

This topic contains 2 replies, has 2 voices, and was last updated by  Alexander Bautz 3 years, 1 month ago.

  • Author
  • #12543

    Sergio Giusti

    Hi I am trying to order my results in the autocomplete script. I have tried the below but although it works fine without the <OrderBy> in it, once I add orderby it stops working and doesn’t recognise the list its looking up from exists anymore. I have tried putting orderby at the front of the And and at the End, ive also tried encapsulating in a <Query> and also a <Where> but no joy on any of them, is the current CAML filter within AutoComplete limited without the ability to Sort or have I missed something? Thanks in advance.

    	"helpText":"Enter the event title...",
    	"filterCAML":"<And><Geq><FieldRef Name='AvailableTickets'></FieldRef><Value Type='Number'>1</Value></Geq><Geq><FieldRef Name='Date'></FieldRef><Value Type='DateTime'><Today/></Value></Geq></And><OrderBy><FieldRef Name='Date' /></OrderBy>",
  • #12577

    Alexander Bautz

    Currently the result is automatically ordered by the “showField” specified in the argument object. Specifying another OrderBy column is not supported.

    Can you give me some more information as to why you need to change the default alphabetical ordering?


  • #12604

    Alexander Bautz

    Cut from from email:

    Hi Alex

    I’m getting to order by date, the data in showing to the user is a concatenated field which is a string, am example would be

    Manchester United v Hull 02/11/2016

    The issue i have is because it’s text, so I was trying to order by another colum in the lookup list which is a date and time field

    Sergio Giusti

    I have added an option to specify the sort column. See change log here: https://spjsblog.com/dffs/dffs-change-log/

    Please let me know how it works out.

    Best regards,

You must be logged in to reply to this topic.