Posts

Showing posts from September, 2015

Adding relations among Table Using X++

Adding relations among tables if they don't exist at table level and  adding range QueryBuildDataSource    qbds;         qbds = this.query().dataSourceTable(tableNum(SalesTable)); qbds.addLink(fieldNum(SalesLine, SalesId), fieldNum(SalesTable, SalesId)); //Adding range qbds.addRange(fieldNum(RouteVersion,SalesId )).value('01');

Passing Records among Forms on Specific Action using Args

Assume a scenario where we have two forms (1)Sales Table (2)Customer Table and we have to pass records from one form to other form on a specific action (e.g. clicked ...)  first declare Args object as follow: Args args; args = new args(); Then specify the record to be passed (assume that Sales Table is the data Source of our form): args.record(salesTable.SalesId); now our record is set in args.record, to pass it to another form call that form as follow:     new MenuFunction(menuitemDisplayStr(CustTable), MenuItemType::Display).run(args); This line of code will rum the customers form and now we can use that record . In addition to check whether our record is valid i.e.it's not Null or its data-source is Sales Table or not.... if(element.args().record() && element.args().dataset() == tableNum(SalesTable)) {      custTableLocal = element.args().record(); } The above line of code verify the record and its data set i.e. Sales Table and allocate that record to