Find and Filter on FormDataSource

Hi In the Ax dev guide says that the findValue() and filter() on a form datasource are activated when the user is selecting the corresponding functions from the right-click menu, over a control that is linked to that database (which seems natural [:D]). However, when inserting breakpoints on those methods, they do not stop when I use find or filter [:(!]. I only catch in executeQuery(). I need to know what filtering/find values are used. Any ideas on how to achieve that? I am using Axapta 30 sp3 in 2-tier configuration. 10x for helping Ciprian

Hi, using the findrange method. There are a lot of forms using code like the following example: void executeQuery() { queryBuildRange queryBuildRange; ; HRMBuildVirtualNetworkDynalinks::buildVirtualNetworkDynalinks(element.args().record(), this); queryBuildRange = this.query().datasourceTable(tableNum(HRMPosition)).findRange(fieldNum(HRMPosition, active)); if (!queryBuildRange) queryBuildRange = this.query().datasourceTable(tableNum(HRMPosition)).addRange(fieldNum(HRMPosition, active)); queryBuildRange.value(showOnlyActive.value() ? queryValue(NoYes::Yes) : queryRange(noYes::No,noYes::Yes)); queryBuildRange = this.query().datasourceTable(tableNum(HRMPosition)).findRange(fieldNum(HRMPosition, type)); if (!queryBuildRange) queryBuildRange = this.query().datasourceTable(tableNum(HRMPosition)).addRange(fieldNum(HRMPosition, type)); queryBuildRange.value(queryValue(hrmPositionType)); super(); element.enable(); } Regards, Alex

Hi Alex, Thanks for your detailed answer[:)]. But, have you tried this your place and worked? When the find/filter commands are used against a form data source, no additional ranges are created in that datasource[:o]. Maybe this is handled in the kernel and is made transparent for the developer. What do you think? Thanks Ciprian

Hi Ciprian,

The same problem for me. Alex code is not working for user-filters.

Did you get any solution?

Thanks

Carlos.

Use this.queryRun().query() instead of this.query().

FormDataSource.query() contains the query definition, but FormDataSource.queryRun() contains the actual query, including custom filters.