Courtesy: http://dynamics-ax-live.blogspot.com/2010/03/how-to-filter-records-in-form-by-code.html Step 1: Declare a class variable In the ClassDeclaration method of the form, define a range. QueryBuildRange CurrencyQBR; Step 2: Instantiate the new range. In the init method on the datasource of the form, you assign the range to a specific field (after the super call). public void init() { super(); CurrencyQBR = this.query().dataSourceName('CustTable').addRange(fieldnum(CustTable,Currency)); } Step 3: In the last step, you assign a value to the range. This is done in the executeQuery method on the same datasource of the form. Before the super call. Like this: public void executeQuery() { ; CurrencyQBR.value(queryvalue('USD')); super(); }
Technical web log for Microsoft Dynamics AX, 365 !!