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

Issue

  • 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?

Environment

  • DXP 7.0+

Resolution

  • 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