Dashboards & Visualizations

If else help

priya0709
Path Finder

In my query Support_tier is a field with 3 numbers eg:- 102, 103, 901,802, 908, 103, 107 and HR_Country is America

My requirement is to have Assignee field to display value based on below:--

If Support_tier have 01 & 02 at the end from above numbers and HR_Country is America then value of Assignee should be 'Earl Vieuten' apart from this all HR_Country which are America should have Assignee as 'Terri' 

Labels (1)
0 Karma
1 Solution

ITWhisperer
SplunkTrust
SplunkTrust
|eval Assignee= case((substr(Support_tier, -2)="02") AND (HR_Country="America"), "Jeremy", (substr(Support_tier, -2)!="02") AND (HR_Country="America"),"Terri")

Try with brackets around the arguments

View solution in original post

ITWhisperer
SplunkTrust
SplunkTrust
| eval Assignee=if(substr(Support_tier,2)="02" OR substr(Support_tier,2)="03","Earl Vieuten","Terri")
0 Karma

priya0709
Path Finder

Thank for your reply. I have modified my query 

|eval Assignee= case(substr(Support_tier, - 2)="02" AND HR_Country="America", "Jeremy")

But other than above Condition all HR_Country to be America should have value "Terri"

Unable to add 2nd condition in my query? 

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust
|eval Assignee= case(substr(Support_tier, -2)="02" AND HR_Country="America", "Jeremy", substr(Support_tier, -2)!="02" AND HR_Country="America","Terri")
0 Karma

priya0709
Path Finder

Getting error with above query

Error in 'eval' command: Type checking failed. 'AND' only takes boolean arguments

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust
|eval Assignee= case((substr(Support_tier, -2)="02") AND (HR_Country="America"), "Jeremy", (substr(Support_tier, -2)!="02") AND (HR_Country="America"),"Terri")

Try with brackets around the arguments

priya0709
Path Finder

I have an if condition | eval Assignee=if(SupportTier="908","DG 908",Assignee)

Which does not work with query below. PLEASE HELP TO FIX THE QUERY

|eval Assignee= case((substr(Support_tier, -2)="02") AND (HR_Country="America"), "Jeremy", (substr(Support_tier, -2)!="02") AND (HR_Country="America"),"Terri")

 

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

In what way does it not work? What is the value of HR_Country in this instance? Also, your if have SupportTier not Support_tier, is this just a typo or a different field?

0 Karma

priya0709
Path Finder

HR_Country =America only when SupportTier is 908

 

0 Karma

priya0709
Path Finder

I will write the conditions again:--

SupportTier =908 & HR_Country = America, Assignee = DG 908

Also to be added with below command

|eval Assignee= case((substr(Support_tier, -2)="02") AND (HR_Country="America"), "Jeremy", (substr(Support_tier, -2)!="02") AND (HR_Country="America"),"Terri")

 

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

OK this new condition has to appear earlier in the case statement (at least before (substr(Support_tier, -2)!="02") AND (HR_Country="America"),"Terri")

| eval Assignee= case(((Support_tier="908") AND (HR_Country="America")), "DG 908", (substr(Support_tier, -2)="02") AND (HR_Country="America"), "Jeremy", (substr(Support_tier, -2)!="02") AND (HR_Country="America"),"Terri")

 

0 Karma

priya0709
Path Finder

Please refer attachment

0 Karma

priya0709
Path Finder

The new query doesn't work as for SupportTier 908 & HR_Country Assignee field turns out to be 'Terri' 

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

You have multiple evals where country is UNITED STATES OF AMERICA so you might want to group these together

| eval Assignee=if(HR_Country="America",case((Support_tier="908"), "DG 908", (Support_tier="909"), "Jimmy Terrell", (substr(Support_tier, -2)="01"), "Jeremy Scala", (substr(Support_tier, -2)="02"), "Jeremy Scala", 1=1 ,"Meinke, Lance and Terry"), Assignee)

Essentially, if it is 908, 909, ends in 01, or ends in 02, it goes to specified people, everything else goes to Meinke, Lance and Terry

 

priya0709
Path Finder

Thank you for your great help👍👍👍

0 Karma
Get Updates on the Splunk Community!

More Control Over Your Monitoring Costs with Archived Metrics!

What if there was a way you could keep all the metrics data you need while saving on storage costs?This is now ...

New in Observability Cloud - Explicit Bucket Histograms

Splunk introduces native support for histograms as a metric data type within Observability Cloud with Explicit ...

Updated Team Landing Page in Splunk Observability

We’re making some changes to the team landing page in Splunk Observability, based on your feedback. The ...