How to get only first record ?
Application Type

Hello people,

i have a form that you can fill in. Each time you fill and save it to the DB, it is visible on a table:

So if you fill and save 5 forms to the DB, you will see 5 times your name and your email. However i was wondering how i can do that you ony see 1/first record on the table and when you click on the name it needs to open all the other forms you filled in. This way the table does not get so full. Any ideas?

Rank: #95

Hello Samed,

Hope you're doing well.

If you have the result of an Aggregate bound to your TableRecords, you can Group By Name / Email to obtain distinct values.

Please refer to this documentation: https://success.outsystems.com/Documentation/11/Developing_an_Application/Use_Data/Query_Data/Get_Distinct_Values_from_the_Database

If your have a List local variable, maybe you can try to use ListDistinct action to filter your duplicate records:

Hope that this helps you!

Edit: I'm assuming that you don't want to see only 1 record, but 1 record per name/email combination (meaning, if you have 2 different names it will appear 2 records).

Kind regards,

Rui Barradas

Rank: #2

Hi Samed,

To retrieve only one, the most recent, record, sort on date/time of creation (assuming you store it), descending, and set the Max. Records to 1. Then when the user clicks the name, start a Screen Action that refreshes the Aggregate but uses a Max. Records of 0 (which will retrieve all records, iirc).

Rank: #446

Hi Samed,

What are you using to bind the source of this table? Is it Aggregate or Advance SQL Query? If you are using Aggregate try the solution as suggested by @Kilian Hekhuis  and if using Advance SQL query use SQL function "Distinct" to fetch the single row from the entity which is having same names and emails addresses.

Thanks & Regards,