Typically Accelerator uses Search-by-Example, where an entity is created with properties populated with the values to search for. Any unpopulated values (set to null) are not searched. Using this approach, it is not possible to explicitly search for records where fields are NULL or not NULL.

To perform an explicit NULL search, create an InputArgs object as usual, initialize its ap_Query property, and then add a WHERE clause:

var inArgs = new AB_SelectInputArgs<ItemMasterEntity>(
    new ItemMasterEntity 
        ItemGrade = grade 

inArgs.ap_Query = inArgs.ap_InputEntity.am_BuildDefaultQuery();

    "IS NOT", 

am_BuildDefaultQuery() is called to create the initial set of WHERE clauses based on the search entity passed to the AB_SelectInputArgs constructor.

am_AddWhereClause() takes four arguments for the overload we need:

  • The string name of the property for the field we want to test
  • "IS" or "IS NOT" for the kind of test we want to do
  • null, for the property value to compare against
  • true, to validate the WHERE clause. (this argument is only set to false when you want to avoid data type conversions)