Question:
How can I search for empty fields using the GAPI?
Answer:
There are two options to search for empty fields using the GAPI.
- The first option is to use a ISimpleSearchCommand and the method AddExtendedCriterion(). Doing this the search string "EMPTY()" has to be used in the AddExtendedCriterion() method, as this example is showing:
IFileCabinetSimpleSearchCommand mySimpleSearch = myFileCabinet.Commands.newSimpleSearch();
mySimpleSearch.AddExtendedCriterion(myField, "EMPTY()");
IResultlist myRL = mySimpleSearch.ExecuteEx(); - The second option is using a ProfessionalSearchCommand:
o the search string has to be constructed manually step by step
o e.g. [FIELD1]=“EMPTY()“ or [STATUS]=“ACTIVE“
o the name of the field always has to be the internal field name (aka column name)
IFileCabinetProfessionalSearchCommand myProfSearch = myFileCabinet.Commands.newProfessionalSearch();
myProfSearch.AddCriterion("[COMPANY] = "[COMPANY] = \"ABC\" OR [COMPANY] = \"Crosslinks BV\"");
IResultlist myRL = myProfSearch.ExecuteEx();