Retrieve last 7 records

Hi,

How to retrieve the last 7 records in a table using X++.

Thanks & Regards,

Chutti

You can use select firstOnly10 … order by … desc to return last ten records. Then use a counter to fetch seven records only.

For example:

while select firstOnly10 t
    order by Field1 desc
{
    i++;
    if (i == 7) break;
}