Dashboards & Visualizations

How to (un)sort an input dropdown in dashboard studio

ktn01
Path Finder

I have the following search

index=dsi_splunk host=dev_splunkmanager script=backup 
| stats earliest(_time) as debut by pid
| convert timeformat="%d/%m/%Y %H:%M" ctime(debut)

 The result is sorted as I need:

Capture.PNG

I use this search as input for a dropdown on dashboard studio but de result is sorted differently:

Capture.PNG

It seems the list is sorted by "value".

 

How may I have an unsorted dropdown to conserve the result order?

 

Thanks 

 

Labels (1)
0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

So, the one you currently have selected is at the top, the rest are in the order returned by the search. This behaviour is different to SimpleXML dropdowns.

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

Which version of Splunk are you using as Studio is under active development and some improvements have been made.

0 Karma

ktn01
Path Finder

I am using Splunk 9.1.1

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

This appears to work for me on 9.1.1.  Please can you try cutting down your dashboard to isolate the issue, then post the source code.

0 Karma

ktn01
Path Finder
{
	"visualizations": {},
	"dataSources": {
		"ds_6STCWAXt": {
			"type": "ds.search",
			"options": {
				"query": "index=dsi_splunk host=dev_splunkmanager script=backup \n| sort _time \n| stats earliest(_time) as debut by pid\n| convert timeformat=\"%d/%m/%Y %H:%M\" ctime(debut)"
			},
			"name": "backupId"
		}
	},
	"defaults": {
		"dataSources": {
			"ds.search": {
				"options": {
					"queryParameters": {
						"latest": "$global_time.latest$",
						"earliest": "$global_time.earliest$"
					}
				}
			}
		}
	},
	"inputs": {
		"input_global_trp": {
			"type": "input.timerange",
			"options": {
				"token": "global_time",
				"defaultValue": "-24h@h,now"
			},
			"title": "Période globale"
		},
		"input_backup": {
			"options": {
				"items": ">frame(label, value) | prepend(formattedStatics) | objects()",
				"token": "backupId",
				"selectFirstSearchResult": true
			},
			"title": "Backup",
			"type": "input.dropdown",
			"dataSources": {
				"primary": "ds_6STCWAXt"
			},
			"context": {
				"formattedConfig": {
					"number": {
						"prefix": ""
					}
				},
				"formattedStatics": ">statics | formatByType(formattedConfig)",
				"statics": [],
				"label": ">primary | seriesByName(\"debut\") | renameSeries(\"label\") | formatByType(formattedConfig)",
				"value": ">primary | seriesByName(\"pid\") | renameSeries(\"value\") | formatByType(formattedConfig)"
			},
			"hideWhenNoData": true
		}
	},
	"layout": {
		"type": "grid",
		"options": {
			"width": 1440,
			"height": 960
		},
		"structure": [],
		"globalInputs": [
			"input_global_trp",
			"input_backup"
		]
	},
	"description": "",
	"title": "Backups Cloner"
}
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!

Can’t Make It to Boston? Stream .conf25 and Learn with Haya Husain

Boston may be buzzing this September with Splunk University and .conf25, but you don’t have to pack a bag to ...

Splunk Lantern’s Guide to The Most Popular .conf25 Sessions

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

Unlock What’s Next: The Splunk Cloud Platform at .conf25

In just a few days, Boston will be buzzing as the Splunk team and thousands of community members come together ...