My guess is that you call your code in init() before super() and therefore datasources are not yet initialized. If you’re not sure what’s happening, step through the code in debugger (sometimes it’s also useful to split a chain of calls to see where exactly it fails).
Right-click a Methods node in AOT, click Override method and choose a method of the parent class to be overridden. This works everywhere in AX - for data source fields, form methods, classes and so on.
I don’t seem to be able to get this to work with the above query and I am still totally blank as to the over ride method talk giving me what I need.
as stated above I get the object not initialised on the init method on the data source. The data source on the form is purchtable but I am trying to create a query based on vendtable. Can that be where the problem lies?
As I said my task is to filter the vendor drop down on the create purchase order form based on a yes no enum on the vendor table.
As I already recommended in my first answer, you should split the calls and check them one by one. Otherwise you’re just complicating your work - and struggle with getting things done.
If you did so, your question would be “Why this.query().dataSourceName(‘VendTable’) returns null?” instead of “Why am I getting some error in init()?”. It would be much clearer where is the problem.
Also, don’t refer to query datasources by name - you often don’t know it. What if it was ‘VendTable_1’? I prefer dataSourceTable(tableNum(VendTable)).
About adding VendTable - just drag VendTable to form datasources, set JoinSource to PurchTable and LinkType to what you need (e.g. InnerJoin). AOT is full of examples.
I hear you. I am trying to learn and don’t want to come across stupid but by asking and trying is the way I am going so I do appreciate your feedback even though you come across a bit blunt [;)] but all good. I can handle it…