How to reference an item from a collection

In a scenario, I’m listing the contents of a Notion page. One of the returned bundles has a collection property called child_database containing 1 item called title
image

How do I use the title in a module?

1 Like

This worked
image
But it seems a bit complicated.

Is there a simpler way?

1 Like

Hello @AlbertoCabasVidani,
Please show the full structure and data of your current collection that you’re using.
That helps to identify where we can use different Make functions.
:+1:

Hi @AlbertoCabasVidani

You do not need to use any function over this mapping as it is inside a collection. Just map the “title” directly instead of “child_database”

For example:
Suppose “child_database” is “sender” and “title” is “Email address”. reference below image:-
image

So here, to get the “Email address”, we will map like this :point_down:

Regards,
Msquare Automation - Platinum Partner of Make
@Msquare_Automation

Yes, this works. But my problem was that I could select title directly only if the first bundle had a value for it. Otherwise, I could only select child_database. I changed the structure of the page so that the child_database was the first block and I could select it.

But I had a more general problem. What if I can’t change the structure of the page?

1 Like

Here’s the output bundles

[
    {
        "object": "block",
        "id": "135cb515-bb6a-805a-9cc3-cfa85141e7f4",
        "parent": {
            "type": "page_id",
            "page_id": "5704ce53-98cf-4778-be73-b354a2dad924"
        },
        "created_time": "2024-11-05T16:11:00.000Z",
        "last_edited_time": "2024-11-08T17:57:00.000Z",
        "created_by": {
            "object": "user",
            "id": "136fcd68-7331-4cb3-8bf3-ac903d4e5d31"
        },
        "last_edited_by": {
            "object": "user",
            "id": "136fcd68-7331-4cb3-8bf3-ac903d4e5d31"
        },
        "has_children": false,
        "archived": false,
        "in_trash": false,
        "type": "child_database",
        "child_database": {
            "title": "Work Flow"
        },
        "__IMTLENGTH__": 3,
        "__IMTINDEX__": 1
    },
    {
        "object": "block",
        "id": "135cb515-bb6a-80cb-99f7-d5d5610e04e6",
        "parent": {
            "type": "page_id",
            "page_id": "5704ce53-98cf-4778-be73-b354a2dad924"
        },
        "created_time": "2024-11-05T16:11:00.000Z",
        "last_edited_time": "2024-11-05T16:11:00.000Z",
        "created_by": {
            "object": "user",
            "id": "136fcd68-7331-4cb3-8bf3-ac903d4e5d31"
        },
        "last_edited_by": {
            "object": "user",
            "id": "136fcd68-7331-4cb3-8bf3-ac903d4e5d31"
        },
        "has_children": false,
        "archived": false,
        "in_trash": false,
        "type": "heading_2",
        "heading_2": {
            "rich_text": [
                {
                    "type": "text",
                    "text": {
                        "content": "heading",
                        "link": null
                    },
                    "annotations": {
                        "bold": false,
                        "italic": false,
                        "strikethrough": false,
                        "underline": false,
                        "code": false,
                        "color": "default"
                    },
                    "plain_text": "heading",
                    "href": null
                }
            ],
            "is_toggleable": false,
            "color": "default"
        },
        "__IMTLENGTH__": 3,
        "__IMTINDEX__": 2
    },
    {
        "object": "block",
        "id": "138cb515-bb6a-80c8-9ccc-c32745dcde80",
        "parent": {
            "type": "page_id",
            "page_id": "5704ce53-98cf-4778-be73-b354a2dad924"
        },
        "created_time": "2024-11-08T17:11:00.000Z",
        "last_edited_time": "2024-11-08T17:12:00.000Z",
        "created_by": {
            "object": "user",
            "id": "136fcd68-7331-4cb3-8bf3-ac903d4e5d31"
        },
        "last_edited_by": {
            "object": "user",
            "id": "136fcd68-7331-4cb3-8bf3-ac903d4e5d31"
        },
        "has_children": false,
        "archived": false,
        "in_trash": false,
        "type": "child_database",
        "child_database": {
            "title": "Tasks"
        },
        "__IMTLENGTH__": 3,
        "__IMTINDEX__": 3
    }
]
1 Like

@AlbertoCabasVidani

You should not need to map everytime. Once you will map the title. It will always work if it exists in the coming bundle.

If the fields you are mapping the title to in your next module is “required”, then you can put an alternative name with “ifempty()” function to avoid skipping any entry OR can set filter for “title exists” if you are fine to skip the entry without title.

Regards,
Msquare Automation - Platinum Partner of Make
@Msquare_Automation