I’m new to SQL and have very similar application. The exception is that I want to return a list of Customer IDs that “start with” given letters. (e.g. starts with ‘ABI’ or ‘AG’ or ‘EH’ or etc.)
Trying to work from @John_Mitchell’s solution I’m thinking an expression like…
WHERE (Customer.CustID LIKE ‘ABI%’ OR
Customer.CustID LIKE ‘AG%’)
This works. Returns all customers with CustID that starts with specified pattern.
Operation: LIKE
Filter:
‘ABI%’ OR
Customer.CustID LIKE ‘AG%’ OR
Customer.CustID LIKE ‘BFG%’ OR
Customer.CustID LIKE ‘BHT%’ OR
Customer.CustID LIKE ‘CS%’ OR
Customer.CustID LIKE ‘USH%’ OR
Customer.CustID LIKE ‘USC%’ OR
Customer.CustID LIKE ‘CIG%’
Field: Company
Operator: =
Expression:
Constants.CompanyID AND
Customer.CustID LIKE 'ABI%' OR
Customer.CustID LIKE 'AG%' OR
Customer.CustID LIKE 'KLIN%' OR
Customer.CustID LIKE 'TWOO%'
Some advice I’ve seen here is that it can be more efficient to tag those records instead of relying on “smart” codes to do selections. If I want to do something with a group of customers, parts, suppliers, etc., I can:
Add a Data Tag
Use a built-in Field
Use Attributes
Add a UD field
It’s easier to maintain the code looking for one thing than constantly changing my selection statement. It also guards from people not using the “smart” code correctly. Food for thought…