Field selection

A field-based query compares the value in a database field with the value in the XML field of the query request.

The following sample query searches for employees:

<QueryMXPERSON>
 <MXPERSONQuery>
<PERSON>
</PERSON>
</MXPERSONQuery>
</QueryMXPERSON>

The following sample query searches for employees where the PERSONID is equal to ATI and STATUS is equal to ACTIVE.

<QueryMXPERSON>
 <MXPERSONQuery>
<PERSON>
<PERSONID operator ="=">ATI</PERSONID>
<STATUS operator ="=">ACTIVE</STATUS>
</PERSON>
</MXPERSONQuery>
</QueryMXPERSON>

The operandMode attribute of the MXPERSONQuery element defines the statement that is run with an AND or an OR condition between the field evaluations. The default condition that is used by the system is the AND condition. Additionally, the operandMode attribute can be provided at a field level. In this case, a field element can have multiple occurrences and can be evaluated for different conditions, such as a quantity field being evaluated as less than 2 or greater than 10.

The following sample query searches for employees where PERSONID is like %ATI%. The operand represents the default behavior and requires no operator value.

<QueryMXPERSON>
 <MXPERSONQuery>
<PERSON>
<PERSONID>ATI</PERSONID>
</PERSON>
</MXPERSONQuery>
</QueryMXPERSON>

The following sample query searches for inventory balances where the bin number is not null.

<QueryMXINVBAL>
  <MXINVBALQuery>
<INVBALANCES>
<BINNUM operator =”!="></BINNUM>
</INVBALANCES >
</MXINVBALQuery>
</QueryMXINVBAL>

The following sample query searches for the inventory balances where the bin number is null.

<MXINVBAL>
<INVBALANCES>
<BINNUM>NULL</BINNUM>
</INVBALANCES >
</MXINVBAL>

The following sample query uses the equivalent of a SQL IN clause to search for the employees whose status is ACTIVE or INACTIVE.

<QueryMXPERSON>
 <MXPERSONQuery>
<PERSON>
<STATUS>ACTIVE,INACTIVE</STATUS>
</PERSON>
</MXPERSONQuery>
</QueryMXPERSON>

The following sample query searches for employees where the PERSONID starts with the letter A.

<QueryMXPERSON>
 <MXPERSONQuery>
<PERSON>
<PERSONID operator ="SW">A</PERSONID>
</PERSON>
</MXPERSONQuery>
</QueryMXPERSON>

The following sample query searches for employees where the PERSONID ends with the letter Z.

<QueryMXPERSON>
 <MXPERSONQuery>
<PERSON>
<PERSONID operator ="EW">Z</PERSONID>
</PERSON>
</MXPERSONQuery>
</QueryMXPERSON>