Forum Discussion
Both the approaches you mentioned would be possible.
For the second approach (using expression library), it is possible to dynamically call expression library functions without using eval(), see Lookup on an array in the input document - #8 by tstack. eval() has a significant performance penalty because the expression has to be parsed for each document being processed.