Tagged: 

This topic contains 1 reply, has 1 voice, and was last updated by  admin 5 years, 3 months ago.

  • Author
    Posts
  • #75655

    admin
    Keymaster

    From an fmREST user, we thought we be of use to others:

    OK, your tool is great, thanks a lot for it … there is only one question …
    We would like to sort when we use findrecords, but we donĀ“t know in which way we can
    put the sort instruction in our source-code …
    $data [‘limit’] = 10 and $data[‘offest’] = 20 works fine … but what is the correct notation for
    $data[‘sort’] for perhaps a field called fieldName ‘SN’ and ‘sortOrder’ may be descend …
    Would be very nice, if you could give us a hint … šŸ™‚
    Thanks a lot and have a nice weekendĀ 

  • #75656

    admin
    Keymaster

    For the function findRecords ($data) use an array of sort objects:

    $sortItem1[‘fieldName’] = “Text1”;
    $sortItem1[‘sortOrder’] = “descend”;
    $data[‘sort’] = array ($sortItem1);

    For the function getRecords ($parameters) use a JSON string:

    $parameters[‘_sort’] = ‘[
    {“fieldName”: “Text1″,”sortOrder”: “descend”},
    {“fieldName”: “Text2”, “sortOrder”: “descend”}
    ]’;

You must be logged in to reply to this topic.