Relevance Query Returns "Singular expression refers to non-unique object"

Hi All,

I’m running the following query to list active network adapters and their associated DNS server settings:

q: concatenation ", " of (addresses of dns servers of adapters whose (address of it as string != "0.0.0.0") of network as string) & ", " & (friendly name of adapters whose (address of it as string != "0.0.0.0") of network as string)

When it runs systems with more than one adapter return the first adapter and then it errors out with “Singular expression refers to non-unique object”. I’m sure it’s something simple, but I’m not seeing where a singular reference is being made.

Thanks for any consideration on this.

It’s probably the friendly name of adapters part. If there is more than one adapter, then there will be more than one name and you’d need friendly names of adapters

Since you’re also using & to concatenate together, you’d need to make the multiple names singular again, like you’re doing with the addresses, so something like concatenation ", " of friendly names of adapters

In fact to tie it all together a bit more sensibly, you’d probably separate results for each adapter individually. Something like

(friendly name of it & ": " & concatenation ", " of (it as string) of addresses of dns servers of it ) of adapters whose (address of it as string != "0.0.0.0") of network
3 Likes

This method is preferred

putting as string at the end is ambiguous and sometimes works, sometimes doesn’t.

Try to keep things in a right to left flow with relevance as much as possible, and keep it plural where it can be.

Related:

Hi Jason,

Changing it to friendly names of adapters just causes it to only return “A singular expression is required.”. But using

(friendly name of it & ": " & concatenation ", " of (it as string) of addresses of dns servers of it ) of adapters whose (address of it as string != "0.0.0.0") of network

worked like a charm! Thanks so much for looking at this.

3 Likes