How to return the Name of a UDSelectOption?

Good Morning,

I’m trying to return the “Name” of the UDSelectOption rather than the “Value” and I’m having trouble figuring out how to access this information. I’ve tried the following code and I have success when using “Value” in place of “Name” but I can’t seem to figure out how to access that information, if it is even possible.

New-UDSelect -Id "mySelect" -Label "Select an option" -Option {
        New-UDSelectOption -Name "Option 1" -Value "1"
        New-UDSelectOption -Name "Option 2" -Value "2"
        New-UDSelectOption -Name "Option 3" -Value "3"
} -OnChange {
    $Data = (Get-UDElement -Id 'mySelect').Name
    Show-UDToast $Data
}

During the OnChange I was hoping to be able to output the “Name” of the currently selected option rather than the “Value.” Is this possible and am I doing something silly?

I did find a workaround to this using the following code.

New-UDSelect -Id "mySelect" -Label "Select an option" -Option {
        New-UDSelectOption -Name "Option 1" -Value "1"
        New-UDSelectOption -Name "Option 2" -Value "2"
        New-UDSelectOption -Name "Option 3" -Value "3"
} -OnChange {
    $options = (Get-UDElement -Id 'mySelect').options
    foreach ($option in $options)
    {
        if ($eventdata -eq $option.value)
        {
            $name = $option.name
            Show-UDToast $Name
        }
    }
}