Dashboards & Visualizations

How to create different tokens from three different result fields depending on if an option is null?

jaffar20
Explorer

I would like to create a token from result fields for meeting dates in different seasons (Autumn, Winter, and Summer). I've created an if function where if the date is more than 30 days from the today, it will display the original date, otherwise it will show NULL. This way past meeting dates will be removed, and future ones will stay.

Now I want to create a token that can extract the date from the new eval fields on the condition that it is not NULL.

I.e. if it has data, it will extract it, if not it will move on to the next one, if null it will go onto the next one etc.

The aim is to be able to extract the result and put the token into a block of text I have in HTML.

Can anyone help?

0 Karma
1 Solution

richgalloway
SplunkTrust
SplunkTrust

What you describe sounds like the coalesce command. It evaluates its arguments in order and uses the first one that is not null.

... | eval date=coalesce(Autumn, Winter, Summer)
---
If this reply helps you, Karma would be appreciated.

View solution in original post

0 Karma

richgalloway
SplunkTrust
SplunkTrust

What you describe sounds like the coalesce command. It evaluates its arguments in order and uses the first one that is not null.

... | eval date=coalesce(Autumn, Winter, Summer)
---
If this reply helps you, Karma would be appreciated.
0 Karma
Get Updates on the Splunk Community!

Unleash the Power of Splunk MCP and AI, Meet Us at .Conf 2025, and Find Even More New ...

Splunk Lantern is a Splunk customer success center that provides advice from Splunk experts on valuable data ...

Observability Professionals: Build Resilience and Visibility with These .conf25 ...

  If you're focused on performance, availability, and full-stack visibility, the Observability track at ...

See just what you’ve been missing | Observability tracks at Splunk University

Looking to sharpen your observability skills so you can better understand how to collect and analyze data from ...