Create a new Datasource and link it through code!
Have you ever wanted, through code, to add a new datasource to an already existing one? Well below is some code that will show you how:
QBSInvent = QBSSum.addDataSource(TableNum(InventItemLocation),"InventItemLocation");
QBSInvent.addLink(fieldnum(InventSum,ItemId),fieldnum(InventItemLocation,ItemId));
QBSInvent.addLink(fieldnum(InventSum,inventDimId),fieldnum(InventItemLocation,inventDimId));
QBSInvent.addRange(FieldNum(InventItemLocation,WhsABC)).value(int2str(gWhsABC));
Basically in this code I create a new Query Database Source, and add it to an already existing one. Then I take and addlink methods to link the two datasources, then the range, and bang! My new datasource now works and is part of the lookup for the given query that may be running for a report, or anything. This is very useful code for working with Dialog's, etc. And you want to add ranges based on different selection types that the user makes.
Check back soon as I will post about integration with Ax 3.0 and what to look for in 4.0!
Find a job at: www.DynamicsAXJobs.com
QBSInvent = QBSSum.addDataSource(TableNum(InventItemLocation),"InventItemLocation");
QBSInvent.addLink(fieldnum(InventSum,ItemId),fieldnum(InventItemLocation,ItemId));
QBSInvent.addLink(fieldnum(InventSum,inventDimId),fieldnum(InventItemLocation,inventDimId));
QBSInvent.addRange(FieldNum(InventItemLocation,WhsABC)).value(int2str(gWhsABC));
Basically in this code I create a new Query Database Source, and add it to an already existing one. Then I take and addlink methods to link the two datasources, then the range, and bang! My new datasource now works and is part of the lookup for the given query that may be running for a report, or anything. This is very useful code for working with Dialog's, etc. And you want to add ranges based on different selection types that the user makes.
Check back soon as I will post about integration with Ax 3.0 and what to look for in 4.0!
Find a job at: www.DynamicsAXJobs.com
0 Comments:
Post a Comment
<< Home