Step 1: Add an Unbound Control for the Display Method
Create an unbound control on the form and bind it to the display method you want to show. This control is used only for display purposes and does not store data directly.
Step 2: Add a Field to the Table
Add a new field in the table where the logic of the display method will be written. This field acts as a helper to support filtering, since display methods alone cannot be directly used in queries.
Step 3: Update the Field Inside the Display Method
In the display method, update the newly added table field with the calculated value. This ensures the field always reflects the same data shown by the display method.
Step 4: Add an Unbound Control for Filtering
Place another unbound control above the grid. This control will be used as a filter input (for example, a string or enum value entered by the user).
Step 5: Apply Filtering Logic in the Data Source
Write the filtering logic in the executeQuery() method of the data source associated with the display method. Use the value from the unbound filter control to modify the query dynamically.
Finally, call the executeQuery() method from the modified() method of the unbound filter control so that the grid refreshes whenever the filter value changes.
Code in Execute query :
FormDataSource wHSInventReserve_ds = this.dataSource(formDataSourceStr(WHSInventOnHandReserve,WHSInventReserve ));
FormStringControl NMCOPTFilter = this.design().controlName(formControlStr(WHSInventOnHandReserve, NMCOPTFilter)); //Unbound control
SysQuery::findOrCreateRange(wHSInventReserve_ds.query().dataSourceTable(tableNum(WHSInventReserve)),
fieldNum(WHSInventReserve, NMCOutsideProcessTag))
.value(SysQuery::valueLikeAfter(!NMCOPTFilter.text() ? '*' : NMCOPTFilter.text()));
No comments:
Post a Comment