Sorting Values By Numerical

Hi everyone,

I’m trying to monitor a network switch.And these are the values I get by the variable:

Interface GigabitEthernet1/0/1
Interface GigabitEthernet1/0/10
.
.
.
Interface GigabitEthernet1/0/19
Interface GigabitEthernet1/0/2

I want to sort it but Numerical ascending sort didn’t really help.Anyone have an idea ?

Hi,

Depending on your source query (SQL or GraphQL) you can sort them using some functions CHARINDEX … since you have a fixed pattern “Interface GigabitEthernet1/0/1” you can start at the 30th character and sort that. For example :
select interface_name, cast (substring (interface_name,30,2) as INT) as interface_num from your_table sort by interface_num.

You can then also sort based on the interface_num on your panel.

Hope it helps.

Good Luck