Example :
We mush select filter some data on table InvenSum. Where AvailPhysical != 0
Step 1: Declare a class variable
In the ClassDeclaration method of the form, define a range.
- QueryBuildRange AvailPhysicalQBR;
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 executeQuery()
- {
- ;
- AvailPhysicalQBR.value(queryvalue('!0'));
- super();
- }
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 init()
- {
- super();
- AvailPhysicalQBR = this.query().dataSourceName('InventSum').addRange(fieldnum(InventSum,AvailPhysical));
- }
You're done! When you open the form, your item Onhand records are filtered, you only get the AvailPhysical != 0.
http://dynamics-ax-live.blogspot.com/2010/03/how-to-filter-records-in-form-by-code.html
หรือต้องการใช้ Like ค้นหาโดยใช้ * เช่นค้นหาเฉพาะ Name ที่เป็น V* ใช้ .value ได้เลย เช่น
- ValveQBR = this.query().dataSourceName('ProdTable').addRange(fieldnum(ProdTable, Name));
- ValveQBR.value('V*');
ตัวอย่าง ProdTableAssemblyTest
No comments:
Post a Comment