Geoffrey, There are two main types of LookupService implementations used by processors like LookupAttribute and LookupRecord, namely LookupService<String> and LookupService<Record>. The former does a single lookup and uses the single returned key. LookupRecord is most often used with LookupService<Record> implementations and will insert all fields from the returned record either as an entire record in one field, or the individual fields from the returned Record (depending on how the processor is configured).
Long story short, to return multiple values you should implement LookupService<Record>, making your lookup method have this signature public Optional<Record> lookup(Map<String, Object> coordinates) throws LookupFailureException The argument to the method is always Map<String,Object>, but the return type is Optional<T> where you implement LookupService<T>. Note that you'll need to construct a Record in order to return multiple values. Please let me know if you have any issues getting going. Regards, Matt On Thu, Feb 25, 2021 at 3:56 PM Greene (US), Geoffrey N <geoffrey.n.gre...@boeing.com> wrote: > > Writing my first ScriptedLookupService in groovy, and I think I have a pretty > simple question: > > I’d like to be able to return multiple values in one lookup, but I can’t > figure out what my return type needs to be. > > String isn’t right, obviously, and returning a Map<Object, String> isn’t > right. > > Is lookup only able to handle one value? Seems like you should be able to > look up multiple values. > > > > class MyValueLookupService implements LookupService<String> { > > ComponentLog log = null > > final String ID = UUID.randomUUID().toString() > > @Override > > Optional<Object> lookup(Map<String,String> lookupMap) { //ß-- wrong > return type > > // this is wrong > > > Optional.ofNullable(slurper.parseText("{\"key1\":\"value1\”,\”key2\”:\”value2\”}")) > > } > > > > @Override > > Class<?> getValueType() { > > // This is wrong too > > return Object > > } > > … other stuff > > } > > lookupService = new MyLookupService() > > > > Thanks > > > > Geoffrey Greene > >