General X++ Development
How do I use `select firstOnly` in X++?
How do I use select firstOnly in X++?
1 answer
Write an answerUse firstOnly when you only need one matching record.
CustTable custTable;
select firstOnly custTable
where custTable.AccountNum == 'US-001';
if (custTable.RecId)
{
info(custTable.name());
}If you only need one row, say that in the query. There is no reason to loop through a result set just to stop after the first record.
Know the solution?
Sign in to contribute an answer and build your community reputation.
Sign in to answer