Copying and pasting methods to save time

Be careful when copying the Find and Exist methods to other tables as a template. As they are static, the methods can technically be on any class or table - that is, check the return type. This can cause some confusion when they behave strangely. As EDTs can be used interchangeably, we won't get a type error unless the base type of the EDT is different. This means that you could pass a variable of type ConWHSVehicleGroupId to InventItemGroup::Find(), and it would simply return a record (or empty buffer) of type InventItemGroup. So, if we copied the Find method from InventItemGroup, to our table the following scenarios are possible:

Code

Result

ConWHSVehicleGroup   group;   
group = ConWHSVehicleGroup::Find(<val>);

This will cause a compilation error, as you can't assign an object of type InventItemGroup to type ConWHSVehicleGroup.

ConWHSVehicleGroup::Find(<val>).Description;   

This will compile without error, but it will try to find value in the InventItemGroup table.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.145.174.57