0
votes

I have a datasource A which can have several B. I've set the prefetch so, from client-side, when you request a A, you also get its associated B sorted by "update_date" (DESC).

On server-side, I'm also requesting some A, and I've set the prefetch the query object so I'm getting my B. But they're not sorted by "update_date".

Do you know why ? Do you if I have to do it by script or I'm missing an option in the query object ?

Thanks for your help

1

1 Answers

0
votes

Acourding documentation: https://developers.google.com/appmaker/scripting/api/server#Query

var query = app.models.Project.newQuery();
query.sorting.Manager.name._descending();
query.run();

About relation: A Manager can have many associated Project records. And a Project can have at most one associated Manager.

it's possible to setup relation sortenter image description here so projects will be sorted asc by name.