Can you limit database results to show only the top results (ordered by a date field)?


  • Not all results in the database are necessary for my purposes. I want to know if it's possible to sort the results by only showing the top results and order it by a date field. 
  • Can this be done without having to involve a custom DynamicQuery?


  • DXP 7.0+


  • This is possible by enabling a workaround.
    • Specify two finder columns when declaring a new folder. Liferay does this as well.
    • As mentioned in the DTD Service Builder in the Github Knowledge Base, the <order> element sets the default ordering. By setting it to the column that you want to use as the date order, you won't need to specify a custom OrderByComparator. It would be best practice for code readability to specify one anyway.



¿Fue útil este artículo?
Usuarios a los que les pareció útil: 0 de 0