mparlak / Flee

Fast Lightweight Expression Evaluator
624 stars 119 forks source link

Question: Is it possible to access the ExpressionContext inside a custom function? #106

Open raphaelcr93 opened 1 year ago

raphaelcr93 commented 1 year ago

Hello,

I have a very specific requirement where I evaluate an expression inside another expression, and would like to know if it possible to leverage the context of the first one inside the second one.

Basically I have on my case I have an expression like this:

ForEach(" ['Item1','Item2','Item3'] ", "CurrentListValue = 'Item2' " )

ForEach() is a custom function that receive 2 strings, one being a list and another being an expression. And then it tries to evaluate the new expression for each item in the list.

The problem is that the new expression can contain variables that are passed to the ForEach function in the first place. And as I need to create a new context, inside the ForEach function, to evaluate the new expression the variables are lost.

Is there any way to do it in the current implementation?