How can I pass field reference in ruby filter while constructing a big string

I would want to construct a sentence having multiple dynamic values, for example

ruby 
{
    code => '
    my_object = 
    {
    "reason" => "I received event.get("baseValueUnitAmount")  event.get("currency") having difference of event.get("[differenceUnitAmount]") compare to previous transaction."
    }
    '
}

Expected output:
I received 25000 INR having difference of 5000 compare to previous transaction

This has been resolved...

one can assign event values to a variable and then pass it with #{value} inside string.

For example

ruby 
{
    code => '
    a = event.get("baseValueUnitAmount")
    b = event.get("currency")
    c = event.get("[differenceUnitAmount]")
    my_object = 
    {
    "reason" => "I received #{a} #{b} having difference of #{c} compare to previous transaction."
    }
    '
}

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.