I'm writing a search that performs a simple eval:
eval changed = case (NOT address="-",address,NOT city="-",city,NOT state="-",state)
One thing I want to do is add some text value to the returned value of the case, based on which boolean worked. For instance, if the address <> "-" I want to return "Address changed to", followed by the value of the field "address", to the new field named "changed".
Is there a way to get the case statement to return that sort of result?
You can concatenate your strings right in the case statement. Assuming your EVAL expression is correct, you could do it like this to get the address as you wish:
... | eval changed = case(NOT address="-", "Address changed to " + address, NOT city="-", city, NOT state="-", state)