Outgoinglink count in metadata

What I’m trying to do

I am trying to make a database table of all my MOC’s, and one of the things that I want to display is the number of outgoing links from each MOC note which automatically counts the links and can be used as metadata to reference in a dataview query.

Things I have tried

I have tried using my own manual count in a piece of metadata, but idealy I want a way to automatically translate the amount of outgoing links into a value which can be displayed.

I’m trying to learn those things myself, so I’m not sure if it’s the right answer. Does something like this work for you?

[outlinks:: = length(this.file.outlinks)]