Array contents in a Custom Component

I have a custom component and want to extract the contents of a one many connections field in a table. There is a handlebars command listed, and the online manual says this

"Working with collection is generally only applicable with certain fields and pipe responses.
Iterating through a one to Many connection field. "

{{#eachProperty obj.field_47}}

This does not work for me, when I enter my field number. And its probably my misunderstanding.

Therefore … is “value” a variable name I need to change - and where would I find that variable?
And does the “obj.” addition to the field name work for all connection fields ?

For pipe responses it would be very different, but for a connection field, can you try this:

{{#each obj.field_47}}

If you need to access the key (ID of the Connected Record), you can do so like this:

{{#each obj.field_47}}
   Value = {{this}} <br>
   Key = {{@key}}

Finally, a useful way to troubleshoot is to log the response to the console, like so:

{{log obj.field_47}}
{{log field_47}}

When logging an object and looking at the console (Ctrl + Shift + J), you’ll see it like this:

Let me know if I can clarify further.

Thanks Moe, I get it now. And it works :grinning:

1 Like

Hey Moe, ist it possible to get value other values from the connected table?

For Example:
I have a Maintable with a one-to-many Field to the Child table.
This Maintable is my Custom Component. In this Component (List) i would get values from the child table with the {{#each obj.field_1843}} function.

How can i target the values?

Many Thanks in advance!