Friday, December 23, 2011

Check for empty values inside a query

Suppose we need to check/filter data inside the tabel on the basis of null values, or we need to fetch the data from a table where the value of the field is null.

sysQuery::valueEmptyString for the select query to fetch the data from the table where there is no value for the selected record.

sysQuery::valueNotEmptyString for filtering data where there is value in the field, this will fetch only those records for which there is value.

For example, we can use this inside filter query on datasources of the form, inside the init or execute query methods.

QueryBuildRange        QueryBuildRange;
;
QueryBuildRange = this.query().dataSourceTable(tablenum(CustTable)).
           addRange(fieldnum(CustTable, AccountNum));
QueryBuildRange.value(sysQuery::valueNotEmptyString());

This will only display non empty records on the form grid.

Reference: http://msdn.microsoft.com/en-us/library/aa866017(v=ax.50).aspx

No comments:

Post a Comment