Orchid Extender Validations

A client is maintaining UPCs code for their items in two places: I/C Items (in an optional field) and I/C Manufacturer's Item Numbers. They wanted to make sure that UPCs are unique across items. Since the validation needed to run while interactively entering information as well as while importing data, Orchid Extender's view subclassing functionaltiy came very handy.

Orchid has many python samples on their site, so I picked one and customized it to validate the I/C Item Optional Field called UPC to only allow unique values. The same for the Manufacturer's Item Numbers. It worked, but performance wasn't great. Upon consulting with Orchid, they recommended that I use the CSQuery view to check for unique values, instead of using the native views for the item optional fields and manufacturer's item numbers respectively. This improved performance considerably, but I still wasn't happy.

The validation was running every time a value was assigned to the optional field (or manufacturer's item number), in the onPut event. I found that the event occurs multiple times, and not ony when the user enters the data. For example, on the Manufacturer's Item Numbers screen, the Put happens every time the user selects a row in the grid. This is not convenient, because we don't need to do any validations just because the user selected a different row. The solution was to change the validation to the onBeforeInsert and onBeforeUpdate events. Much better user experience and performance.