There are multiple ways to do that. Here is couple of suggestions :
- the simple one - you can specify the number of rows that will be displayed in the properties of the grid "Number of rows" to 3 and that will display only the first 3 rows always.
Alternatively,
- you can use a microflow to "Retrieve" the data, count the records until they are <=3 and display the list on the grid.
Unless you have a particular reason that you needed to use Xpath ?
To add to the answers that Yonas and Rom have given, you can use a microflow as datasource for your grid and then use the following to retrieve the items:
As you can see here, I've specified that I want the first three results, after sorting the items in descending order on an Integer attribute. So if my database contains "MyEntity"-objects with the values: 1, 2, 3, 4, and 5 as "IntValue". They will be sorted by the database in descending order, so: 5, 4, 3, 2, 1. And I've speciefied that I want only 3 items, starting from position 0, resulting in the objects that have 5, 4 and 3 as value.
Thanks everyone! I will use these suggestions to figure what option works for me.