Hi,
I have a managed database for an Entity, "Program", containing a String field, "description", that is effectively a unique sub-string of a system generated description.
Example:
System: For Series Sales usage: 6014-Private Individual Swim Lessons 10-Pack
Database: 6014-Private Individual Swim Lessons 10-Pack
I would like to know if it is possible to have a query return the "Program" object using the System Description?
I've considered doing something similar to...
SELECT FROM Program WHERE description LIKE " [something] "
...but, this doesn't seem like it will work even when using wildcards as the input string will be larger than the string being searched for.
Presently, the only solution I have is to iterate over all the Program objects manually and find one that is contained within the System Description.
public static Program programByDescription(String desc) { for(Program p : allPrograms()) if(desc.contains(p.getDescription())) return p; return null; }
Is there a more optimal way to do this?