Re: [jexl] How to use math functions with JEXL

2020-04-19 Thread swapnil vaidya
You will have to register math as name space with JexlContext

https://commons.apache.org/proper/commons-jexl/apidocs/org/apache/commons/jexl3/package-summary.html

Regards,
Swapnil

On Sun, Apr 19, 2020 at 10:51 AM Greenberg, Gary 
wrote:

> I am trying to evaluate an expression that beside simple arithmetic need
> to calculate square root.
>
> I tried sqrt(), Math.sqrt() and java.lang.Math.sqrt and nothing works
>
> I am always getting something like @1:1 undefined variable java.lang.Math.
>
> I did use before expr4j and it has all these functions built-in.
>
> Switched to JEXL, because need not only numeric, but also Boolean
> expressions.
>
> Can you also confirm if this type of expressions will work:
>
> a.equalsIgnoreCase(“XYZ”) && b.startWith(“http”)
>
> where a and b are variables in the JexlContext.
>
>
>
> Gary Greenberg
>
> Staff Software Engineer
>
> Data Product Development, BI-A
>
> E: ggree...@visa.com
>
> M: 650-269-7902
>
>
>
> [image: EmailSig-TaglineVersion]
>
>
>


Problem with passing multiple params in calling method through Jexl expression

2019-07-24 Thread swapnil vaidya
Hi,
I have requirement that, I need to call a function which take multiple
params.
I need to create a sub Array from the original Array.
Following is the expression I am calling:
"".class.forName(\"java.utils.Arrays\").copyOfRange(#{default.alarms.results},0,1)",

the #{default.alarms.results} is the value that will be evaluated runtime
by jsonpath expression.

This gives me an error as unresolvable method/function. However if we call
any other method which takes single param, it works.

Could you please help me with this?

Regards,
Swapnil