Hi, We anticipate development of components that will involve different behavior depending on the current company account (for example a form that performs different calculations based on the currently active company). We would like to plan ahead in case it will mean changes as extreme as multiple installations running different codebases. After a bit of investigation I am convinced that using the polymorphism support in X++ with, for example a static factory function (similar to the ‘construct’ example in the advanced X++ seminar) that returns specialised objects based on the value returned by appl.company() or curext() will solve the problem, without lots of if or case statements littered all over and needing maintenance. However, I would just like to know if there is perhaps an even simpler way, something akin to the layer system. Can one specify different forms/classes etc per company from within the AOT somehow? thanks, Matt
Hi, I think, you can not solve this problem with AOT… And I think, using appl.company() or curext() is bad idea, too. I should make special field in the table CompanyInfo, sample “TypeOfSomething” type of BaseEnum, and check its state in my methods. This way gives you possibility tuning you companys without coding… Good luck…
Hi I agree with Nikolay. Don’t make it too complex and state of the art. A working system is much better than a sophisticated but complex system. (At least that’s my opinion)