Splunk Search

Using eval to set token in drilldown does not work

bowesmana
SplunkTrust
SplunkTrust

I have a row in a table called DMPrice

<set token="dmp">$row.DMPrice$</set>

this works, however, if there is no DMPrice value, then the token ends up being shown as null in another html panel.

So I tried this:

<eval token="dmp">if(isnull('$row.DMPrice$',"N/A",'$row.DMPrice$')</eval>

both with and without the '' round the row var, but all I get in the html panel is $dmp$, which is what I have in the panel, i.e. referring to the token, so clearly it's not being set at all. What I wanted it to be was N/A if it's null, but no joy.

Any ideas?

Tags (3)
0 Karma
1 Solution

rjthibod
Champion

You have a syntax issue with a missing parenthesis. Try this where you don't use the single quotes and add the closing parenthesis.

<eval token="dmp">if(isnull($row.DMPrice$), &quot;N/A&quot;, $row.DMPrice$)</eval>

View solution in original post

0 Karma

rjthibod
Champion

You have a syntax issue with a missing parenthesis. Try this where you don't use the single quotes and add the closing parenthesis.

<eval token="dmp">if(isnull($row.DMPrice$), &quot;N/A&quot;, $row.DMPrice$)</eval>

0 Karma

bowesmana
SplunkTrust
SplunkTrust

Sorry for the late response, only managed to revisit this. That worked nicely thanks. I always miss brackets with eval clauses and can never see them.

0 Karma
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.

Can’t make it to .conf25? Join us online!

Get Updates on the Splunk Community!

Take Action Automatically on Splunk Alerts with Red Hat Ansible Automation Platform

 Are you ready to revolutionize your IT operations? As digital transformation accelerates, the demand for ...

Calling All Security Pros: Ready to Race Through Boston?

Hey Splunkers, .conf25 is heading to Boston and we’re kicking things off with something bold, competitive, and ...

Beyond Detection: How Splunk and Cisco Integrated Security Platforms Transform ...

Financial services organizations face an impossible equation: maintain 99.9% uptime for mission-critical ...