Splunk Search

Error while creating eval expression for calculated fields in data models

pdantuuri0411
Explorer

I have a data model and defined about 5 fields. But one of the fields doesnt always have a value. I want it to show as "null" when there is no value in the log. So for this particular field, I created it as a calculated field(systemid) and gave an eval expression systemid=if(isnull(systemid),"NULL",systemid). Now I get the error "Error in 'eval' command: Fields cannot be assigned a boolean result. Instead, try if([bool expr], [expr], [expr])."

0 Karma

richgalloway
SplunkTrust
SplunkTrust

What you have should work. Try this alternative, however: systemid = coalesce(systemid, "NULL").

---
If this reply helps you, Karma would be appreciated.
0 Karma

pdantuuri0411
Explorer

Thank you for the reply @rickgalloway

I just copy pasted systemid = coalesce(systemid, "NULL") in eval expression in calculated fields and I get the same error Error in 'eval' command: Fields cannot be assigned a boolean result. Instead, try if([bool expr], [expr], [expr]).

Regards.

0 Karma
Get Updates on the Splunk Community!

Index This | I am a number, but when you add ‘G’ to me, I go away. What number am I?

March 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...

What’s New in Splunk App for PCI Compliance 5.3.1?

The Splunk App for PCI Compliance allows customers to extend the power of their existing Splunk solution with ...

Extending Observability Content to Splunk Cloud

Register to join us !   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to ...