✏️ Explanatory Question

Table method exists() in D365

👁 2,866 Views
📘 Detailed Answer
💡

Answer with Explanation

As with the find method, there should also exist an exists method. It basically works the same as the find method, except that it just returns true if a record with the unique index specified by the input parameter(s) is found. In the next example from the InventTable you can see that it returns true if the input parameter has a value AND the select statement returns a value.



static boolean exist(ItemId itemId)
{
    return itemId && (select RecId from inventTable
    index hint ItemIdx
    where inventTable.ItemId == itemId
    ).RecId != 0;
}