Hide some form records based on a field value

Hi,

I have a requirement where I need to hide certain records of a form, this is based on the condition if a certain value is configured for the field present in the record. Hence, the records which have that field value present need not be shown to the user. How can I achieve this. Any help would be much appreciated, Thanks in advance!

You must modify the query used by the form and add a range or a filter. How exactly this can be done depends on whether it’s your form or you’re writing an extension.

Here is a simple example (for init() method of a form datasource):

QueryBuildRange range = this.queryBuildDataSource().addRange(fieldNum(MyTable, MyField));
range.value(SysQuery::valueNot(...));