Closed BuddhiWathsala closed 5 years ago
According to the discussion of this siddhi-dev mail thread, we are going to implement two functions to cater above requirements.
Update previous str:fillTemplate
receive a string and a key-value map. Then replace all key entries with a corresponding value. For example it will receive,
str:fillTemplate("{{prize}} > 100 && {{salary}} < 10000", map:create('prize', 300, 'salary', 10000)))
and return string 300 > 100 && 10000 < 10000
Then we will add another function js:eval( "56 > 76", 'bool')
to evaluate expressions in https://github.com/siddhi-io/siddhi-script-js
Description:
Problem
Currently, Siddhi execution string does not support string manipulation for the following scenarios.
S=" {{prize}} > 100 "
and the value of the prize coming from a different stream. Assume that, now the prize is 300. Then I need to get the stringS'= "300 > 100"
S' = "300 > 100"
and evaluate it. The evaluation of that mathematical expression should returntrue
.Suggestion
str: map(STRING, STRING...)
and this will return a STRING.str: eval(STRING, STRING...)
and this will return an Object.Suggested Labels: Feature improvement