Table method exists() in D365

X++ Programming Language >   D365 Table >   Table Methods  

Long Question

3180


Answer:

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;
}




This Particular section is dedicated to Question & Answer only. If you want learn more about X++ Programming Language. Then you can visit below links to get more depth on this subject.




Join Our telegram group to ask Questions

Click below button to join our groups.