Dynamic replace based on expression



I wonder if you can help me come up with a solution.

How to replace values from one input with values from another, where the new value is calculated with an expression.

Example below:

input 1:

input 2:


Input 2 is dynamic so I'd need a tool that can read the expression/ statement from Input 2 and apply to Input 1.

Any ideas how to implement this logic in Aperture would be greatly appreciated.

Thank you