UFM How to get the length of a blocklist array

Hi,

Using Umbraco v16.3 and try to display the amount of childblocks in a label.

According to the docs that should be doable using ${ propertyAlias.length }, When I use ${ menuItems.length } (menuItems is the property that holds the blocklist) The label is empty. Anything I am missing? We will upgrade to V17 soonish so if it is working there I would also love to know.

Thanks,

Richard

Hi @rsoeteman

I would assume the problem is that the model for Block Editors are more complex than a simple array.
You can read about the model here: Block Grid | Umbraco CMS

So I would mean you should try something like this:

${ menuItems.layout['Umbraco.BlockList'].length }

I hope that works, or leads you to a solution.

Best, Niels

Thanks Niels, will try that!