Strange result when searching an Object in Notion

I’m getting data from a tally form and using it to search an object in a Notion database.
The database holds the names of the employees of a holding.
So, in the form, the user first selects the company name within the holding from a dropdown, then he selects the name of the employee from another dropdown.

Then, I use the employee name to search in Notion using the Search Object module.

The Tally module’s output includes a field for a company, only when an employee from the corresponding dropdown is selected.

So, I created a list of filters like this

It should work this way:

  • if an employee from the first dropdown is chosen, search for it in the database
  • otherwise, look for the second
  • and so on

When I submit a form with an employee matching the first filter, it works.
When I instead select an employee matching any of the following filters, the module returns the wrong employee, always the same one.

Why?

Here’s some data to help:

[
    {
        "responseId": "GgpN5O",
        "submissionId": "GgpN5O",
        "respondentId": "VMAYVv",
        "formId": "w8elGY",
        "formName": "Richieste dei collaboratori_OK",
        "createdAt": "2024-08-08T10:56:22.000Z",
        "fields": {
            "Data richiesta": "2024-08-15",
            "SOCIETÀ": [
                "TREND SRL"
            ],
            "TREND SRL": [
                "BORTOLOZZO PIERO"
            ],
            "Giornaliero?": [
                "Sì"
            ],
            "Data": "2024-08-28",
            "Ora Inizio": "05:03",
            "Ora fine": "10:04",
            "Data Inizio": null,
            "Data Fine": null,
            "Motivo": [
                "Ferie"
            ],
            "N. Certificato Medico": null,
            "NOTE": "asdfasdf"
        },
        "eventId": "dda1977e-5c3b-456b-9e9a-d6f286260318",
        "fieldsById": {
            "question_a9OvQq": "2024-08-15",
            "question_jZZo8a": [
                "TREND SRL"
            ],
            "question_L9DkP2": [
                "BORTOLOZZO PIERO"
            ],
            "question_vMXKGQ": [
                "Sì"
            ],
            "question_KzpkY7": "2024-08-28",
            "question_L9DkD1": "05:03",
            "question_preveb": "10:04",
            "question_7qXMRA": null,
            "question_bqZv5o": null,
            "question_9BBZkY": [
                "Ferie"
            ],
            "question_1XW6WW": null,
            "question_1XW69L": "asdfasdf"
        }
    }
]

I think I can solve with a router. But then I’d have to duplicate the rest of the scenario five times. I’d like to avoid it.

Here’s the Notion module output too (couldn’t add it above, too long)

Notion search module output

[
{
“object”: “page”,
“id”: “34c05c66-9f1a-45df-a5dc-51dc82323a17”,
“created_time”: “2024-07-26T09:39:00.000Z”,
“last_edited_time”: “2024-07-29T03:49:00.000Z”,
“created_by”: {
“object”: “user”,
“id”: “e4fa2112-af35-473f-b75a-01d2ef739946”
},
“last_edited_by”: {
“object”: “user”,
“id”: “e4fa2112-af35-473f-b75a-01d2ef739946”
},
“cover”: null,
“icon”: null,
“parent”: {
“type”: “database_id”,
“database_id”: “1a863a03-9a4c-4614-a51d-2e3d3ec210b2”
},
“archived”: false,
“in_trash”: false,
“properties”: [
{
“id”: “%3B%60gh”,
“type”: “number”,
“number”: 0,
“label”: “ID Commercialista”
},
{
“id”: “A%5ED%5E”,
“type”: “multi_select”,
“multi_select”: [
{
“id”: “1d944afc-b628-4e83-81a7-d627a708728a”,
“name”: “Speaker”,
“color”: “orange”
}
],
“label”: “Ruolo”
},
{
“id”: “Dptq”,
“type”: “select”,
“select”: {
“id”: “U|BU”,
“name”: “C-SPHERA S.R.L.”,
“color”: “blue”
},
“label”: “Radio”
},
{
“id”: “Q%3BiG”,
“type”: “relation”,
“relation”: [
{
“id”: “3ff0d3eb-83d5-47e4-83ec-9d0480e80218”
},
{
“id”: “43a6c1fa-8e09-4979-b74a-574e0b4200cd”
},
{
“id”: “d5b2872f-f11b-4440-a95e-151c2620af6d”
},
{
“id”: “afd4dcb0-3a10-412d-ad5c-503c0df0033c”
},
{
“id”: “189b8bd1-21de-4fa9-851e-54fa3deb7790”
},
{
“id”: “db590cae-6a13-4228-b41b-87912591b446”
},
{
“id”: “43c24bba-faed-405c-843e-f242f48449c8”
},
{
“id”: “fff761dd-d0b0-81ba-b6e7-f944c2cea799”
},
{
“id”: “050d13dd-5c32-4cf0-b111-89c4f4b10d2b”
},
{
“id”: “c23472d4-2e83-4dd2-b144-93352e5e221f”
},
{
“id”: “e09096e0-ddee-4b14-8f05-19b6e1882909”
},
{
“id”: “5a59c343-72ab-4fc3-8708-5bd6680dd774”
},
{
“id”: “2b383fd1-a186-4b4f-8894-8db30974695e”
},
{
“id”: “5baa4aae-49dd-41db-bb7f-067a2fdf7cce”
},
{
“id”: “6dfc706e-a4d7-48fd-aab7-ec8ea8df2d68”
},
{
“id”: “58ae98ee-4c82-451b-9373-adbc08b1e04d”
},
{
“id”: “9cf929b3-ced6-4270-8f92-4d03d39f573c”
},
{
“id”: “997ade39-1658-453c-acf6-ad14f8a0617e”
},
{
“id”: “1a70ad20-5012-44b2-bf46-09e5ebc2b634”
},
{
“id”: “6890cc36-0da2-4306-9dcb-ea362c4f15c8”
},
{
“id”: “966e4d99-7aef-43f2-b875-16d71dd128dc”
}
],
“has_more”: false,
“label”: “RICHIESTE”
},
{
“id”: “Re%40I”,
“type”: “formula”,
“formula”: {
“type”: “string”,
“string”: “PISTOLIN MICHELA (JAY)”
},
“label”: “Collaboratore(testo)”
},
{
“id”: “Tmg%5C”,
“type”: “phone_number”,
“phone_number”: null,
“label”: “Phone”
},
{
“id”: “VJ%5B%3D”,
“type”: “email”,
“email”: null,
“label”: “Email”
},
{
“id”: “Y%3AFC”,
“type”: “multi_select”,
“multi_select”: [
{
“id”: “Lafg”,
“name”: “C-SPHERA S.R.L.”,
“color”: “purple”
}
],
“label”: “Società”
},
{
“id”: “%5E%3AQ%5E”,
“type”: “rollup”,
“rollup”: {
“type”: “array”,
“array”: ,
“function”: “show_original”
},
“label”: “Periodo richiesta”
},
{
“id”: “%60%40%5Ep”,
“type”: “rollup”,
“rollup”: {
“type”: “array”,
“array”: [
{
“type”: “date”,
“date”: null
},
{
“type”: “date”,
“date”: null
},
{
“type”: “date”,
“date”: null
},
{
“type”: “date”,
“date”: null
},
{
“type”: “date”,
“date”: null
},
{
“type”: “date”,
“date”: null
},
{
“type”: “date”,
“date”: null
},
{
“type”: “date”,
“date”: null
},
{
“type”: “date”,
“date”: null
},
{
“type”: “date”,
“date”: null
},
{
“type”: “date”,
“date”: {
“start”: “2024-08-09”,
“end”: null,
“time_zone”: null
}
},
{
“type”: “date”,
“date”: {
“start”: “2024-08-16”,
“end”: null,
“time_zone”: null
}
},
{
“type”: “date”,
“date”: {
“start”: “2024-08-02T09:16:00.000+02:00”,
“end”: null,
“time_zone”: null
}
},
{
“type”: “date”,
“date”: {
“start”: “2024-08-09T00:00:00.000+02:00”,
“end”: null,
“time_zone”: null
}
},
{
“type”: “date”,
“date”: {
“start”: “2024-08-09T06:17:00.000+02:00”,
“end”: null,
“time_zone”: null
}
},
{
“type”: “date”,
“date”: {
“start”: “2024-08-09T00:00:00.000+02:00”,
“end”: null,
“time_zone”: null
}
},
{
“type”: “date”,
“date”: {
“start”: “2024-08-14T15:09:00.000+02:00”,
“end”: null,
“time_zone”: null
}
},
{
“type”: “date”,
“date”: null
},
{
“type”: “date”,
“date”: null
},
{
“type”: “date”,
“date”: null
},
{
“type”: “date”,
“date”: null
}
],
“function”: “show_original”
},
“label”: “ACV Data inizio richiesta”
},
{
“id”: “hON%3E”,
“type”: “rich_text”,
“rich_text”: [
{
“type”: “text”,
“text”: {
“content”: “Michela Jay”,
“link”: null
},
“annotations”: {
“bold”: false,
“italic”: false,
“strikethrough”: false,
“underline”: false,
“code”: false,
“color”: “default”
},
“plain_text”: “Michela Jay”,
“href”: null
}
],
“label”: “Nome d’arte”
},
{
“id”: “hbLa”,
“type”: “rich_text”,
“rich_text”: ,
“label”: “Codice Fiscale”
},
{
“id”: “mPh%3A”,
“type”: “rollup”,
“rollup”: {
“type”: “array”,
“array”: [
{
“type”: “date”,
“date”: {
“start”: “2011-11-01T00:00:00.000+01:00”,
“end”: null,
“time_zone”: null
}
},
{
“type”: “date”,
“date”: {
“start”: “2024-08-09T00:00:00.000+02:00”,
“end”: null,
“time_zone”: null
}
},
{
“type”: “date”,
“date”: {
“start”: “2024-08-08T00:00:00.000+02:00”,
“end”: null,
“time_zone”: null
}
},
{
“type”: “date”,
“date”: null
},
{
“type”: “date”,
“date”: null
},
{
“type”: “date”,
“date”: null
},
{
“type”: “date”,
“date”: null
},
{
“type”: “date”,
“date”: {
“start”: “2024-08-09T00:00:00.000+02:00”,
“end”: null,
“time_zone”: null
}
},
{
“type”: “date”,
“date”: null
},
{
“type”: “date”,
“date”: {
“start”: “2024-08-09T00:00:00.000+02:00”,
“end”: null,
“time_zone”: null
}
},
{
“type”: “date”,
“date”: {
“start”: “2024-08-09T00:00:00.000+02:00”,
“end”: null,
“time_zone”: null
}
},
{
“type”: “date”,
“date”: {
“start”: “2024-08-16T17:18:00.000+02:00”,
“end”: null,
“time_zone”: null
}
},
{
“type”: “date”,
“date”: {
“start”: “2024-08-02T17:17:00.000+02:00”,
“end”: null,
“time_zone”: null
}
},
{
“type”: “date”,
“date”: {
“start”: “2024-08-10T23:59:00.000+02:00”,
“end”: null,
“time_zone”: null
}
},
{
“type”: “date”,
“date”: {
“start”: “2024-08-09T18:18:00.000+02:00”,
“end”: null,
“time_zone”: null
}
},
{
“type”: “date”,
“date”: {
“start”: “2024-08-11T23:59:00.000+02:00”,
“end”: null,
“time_zone”: null
}
},
{
“type”: “date”,
“date”: {
“start”: “2024-08-14T17:15:00.000+02:00”,
“end”: null,
“time_zone”: null
}
},
{
“type”: “date”,
“date”: null
},
{
“type”: “date”,
“date”: null
},
{
“type”: “date”,
“date”: null
},
{
“type”: “date”,
“date”: null
}
],
“function”: “show_original”
},
“label”: “ACV Data Fine Richiesta”
},
{
“id”: “sc%5C%3B”,
“type”: “unique_id”,
“unique_id”: {
“prefix”: “SPH”,
“number”: 78
},
“label”: “SPH”
},
{
“id”: “title”,
“type”: “title”,
“title”: [
{
“type”: “text”,
“text”: {
“content”: “PISTOLIN MICHELA (JAY)”,
“link”: null
},
“annotations”: {
“bold”: false,
“italic”: false,
“strikethrough”: false,
“underline”: false,
“code”: false,
“color”: “default”
},
“plain_text”: “PISTOLIN MICHELA (JAY)”,
“href”: null
}
],
“label”: “Collaboratore”
}
],
“url”: “https://www.notion.so/PISTOLIN-MICHELA-JAY-34c05c669f1a45dfa5dc51dc82323a17”,
“public_url”: null,
“properties_value”: {
“ID Commercialista”: 0,
“Ruolo”: [
{
“id”: “1d944afc-b628-4e83-81a7-d627a708728a”,
“name”: “Speaker”,
“color”: “orange”
}
],
“Radio”: {
“id”: “U|BU”,
“name”: “C-SPHERA S.R.L.”,
“color”: “blue”
},
“RICHIESTE”: [
{
“id”: “3ff0d3eb-83d5-47e4-83ec-9d0480e80218”
},
{
“id”: “43a6c1fa-8e09-4979-b74a-574e0b4200cd”
},
{
“id”: “d5b2872f-f11b-4440-a95e-151c2620af6d”
},
{
“id”: “afd4dcb0-3a10-412d-ad5c-503c0df0033c”
},
{
“id”: “189b8bd1-21de-4fa9-851e-54fa3deb7790”
},
{
“id”: “db590cae-6a13-4228-b41b-87912591b446”
},
{
“id”: “43c24bba-faed-405c-843e-f242f48449c8”
},
{
“id”: “fff761dd-d0b0-81ba-b6e7-f944c2cea799”
},
{
“id”: “050d13dd-5c32-4cf0-b111-89c4f4b10d2b”
},
{
“id”: “c23472d4-2e83-4dd2-b144-93352e5e221f”
},
{
“id”: “e09096e0-ddee-4b14-8f05-19b6e1882909”
},
{
“id”: “5a59c343-72ab-4fc3-8708-5bd6680dd774”
},
{
“id”: “2b383fd1-a186-4b4f-8894-8db30974695e”
},
{
“id”: “5baa4aae-49dd-41db-bb7f-067a2fdf7cce”
},
{
“id”: “6dfc706e-a4d7-48fd-aab7-ec8ea8df2d68”
},
{
“id”: “58ae98ee-4c82-451b-9373-adbc08b1e04d”
},
{
“id”: “9cf929b3-ced6-4270-8f92-4d03d39f573c”
},
{
“id”: “997ade39-1658-453c-acf6-ad14f8a0617e”
},
{
“id”: “1a70ad20-5012-44b2-bf46-09e5ebc2b634”
},
{
“id”: “6890cc36-0da2-4306-9dcb-ea362c4f15c8”
},
{
“id”: “966e4d99-7aef-43f2-b875-16d71dd128dc”
}
],
“Collaboratore(testo)”: {
“type”: “string”,
“string”: “PISTOLIN MICHELA (JAY)”
},
“Phone”: null,
“Email”: null,
“Società”: [
{
“id”: “Lafg”,
“name”: “C-SPHERA S.R.L.”,
“color”: “purple”
}
],
“Periodo richiesta”: {
“type”: “array”,
“array”: ,
“function”: “show_original”
},
“ACV Data inizio richiesta”: {
“type”: “array”,
“array”: [
{
“type”: “date”,
“date”: null
},
{
“type”: “date”,
“date”: null
},
{
“type”: “date”,
“date”: null
},
{
“type”: “date”,
“date”: null
},
{
“type”: “date”,
“date”: null
},
{
“type”: “date”,
“date”: null
},
{
“type”: “date”,
“date”: null
},
{
“type”: “date”,
“date”: null
},
{
“type”: “date”,
“date”: null
},
{
“type”: “date”,
“date”: null
},
{
“type”: “date”,
“date”: {
“start”: “2024-08-09”,
“end”: null,
“time_zone”: null
}
},
{
“type”: “date”,
“date”: {
“start”: “2024-08-16”,
“end”: null,
“time_zone”: null
}
},
{
“type”: “date”,
“date”: {
“start”: “2024-08-02T09:16:00.000+02:00”,
“end”: null,
“time_zone”: null
}
},
{
“type”: “date”,
“date”: {
“start”: “2024-08-09T00:00:00.000+02:00”,
“end”: null,
“time_zone”: null
}
},
{
“type”: “date”,
“date”: {
“start”: “2024-08-09T06:17:00.000+02:00”,
“end”: null,
“time_zone”: null
}
},
{
“type”: “date”,
“date”: {
“start”: “2024-08-09T00:00:00.000+02:00”,
“end”: null,
“time_zone”: null
}
},
{
“type”: “date”,
“date”: {
“start”: “2024-08-14T15:09:00.000+02:00”,
“end”: null,
“time_zone”: null
}
},
{
“type”: “date”,
“date”: null
},
{
“type”: “date”,
“date”: null
},
{
“type”: “date”,
“date”: null
},
{
“type”: “date”,
“date”: null
}
],
“function”: “show_original”
},
“Nome d’arte”: [
{
“type”: “text”,
“text”: {
“content”: “Michela Jay”,
“link”: null
},
“annotations”: {
“bold”: false,
“italic”: false,
“strikethrough”: false,
“underline”: false,
“code”: false,
“color”: “default”
},
“plain_text”: “Michela Jay”,
“href”: null
}
],
“Codice Fiscale”: ,
“ACV Data Fine Richiesta”: {
“type”: “array”,
“array”: [
{
“type”: “date”,
“date”: {
“start”: “2011-11-01T00:00:00.000+01:00”,
“end”: null,
“time_zone”: null
}
},
{
“type”: “date”,
“date”: {
“start”: “2024-08-09T00:00:00.000+02:00”,
“end”: null,
“time_zone”: null
}
},
{
“type”: “date”,
“date”: {
“start”: “2024-08-08T00:00:00.000+02:00”,
“end”: null,
“time_zone”: null
}
},
{
“type”: “date”,
“date”: null
},
{
“type”: “date”,
“date”: null
},
{
“type”: “date”,
“date”: null
},
{
“type”: “date”,
“date”: null
},
{
“type”: “date”,
“date”: {
“start”: “2024-08-09T00:00:00.000+02:00”,
“end”: null,
“time_zone”: null
}
},
{
“type”: “date”,
“date”: null
},
{
“type”: “date”,
“date”: {
“start”: “2024-08-09T00:00:00.000+02:00”,
“end”: null,
“time_zone”: null
}
},
{
“type”: “date”,
“date”: {
“start”: “2024-08-09T00:00:00.000+02:00”,
“end”: null,
“time_zone”: null
}
},
{
“type”: “date”,
“date”: {
“start”: “2024-08-16T17:18:00.000+02:00”,
“end”: null,
“time_zone”: null
}
},
{
“type”: “date”,
“date”: {
“start”: “2024-08-02T17:17:00.000+02:00”,
“end”: null,
“time_zone”: null
}
},
{
“type”: “date”,
“date”: {
“start”: “2024-08-10T23:59:00.000+02:00”,
“end”: null,
“time_zone”: null
}
},
{
“type”: “date”,
“date”: {
“start”: “2024-08-09T18:18:00.000+02:00”,
“end”: null,
“time_zone”: null
}
},
{
“type”: “date”,
“date”: {
“start”: “2024-08-11T23:59:00.000+02:00”,
“end”: null,
“time_zone”: null
}
},
{
“type”: “date”,
“date”: {
“start”: “2024-08-14T17:15:00.000+02:00”,
“end”: null,
“time_zone”: null
}
},
{
“type”: “date”,
“date”: null
},
{
“type”: “date”,
“date”: null
},
{
“type”: “date”,
“date”: null
},
{
“type”: “date”,
“date”: null
}
],
“function”: “show_original”
},
“SPH”: {
“prefix”: “SPH”,
“number”: 78
},
“Collaboratore”: [
{
“type”: “text”,
“text”: {
“content”: “PISTOLIN MICHELA (JAY)”,
“link”: null
},
“annotations”: {
“bold”: false,
“italic”: false,
“strikethrough”: false,
“underline”: false,
“code”: false,
“color”: “default”
},
“plain_text”: “PISTOLIN MICHELA (JAY)”,
“href”: null
}
]
},
IMTLENGTH”: 1,
IMTINDEX”: 1
}
]

I think that might be happening because it finds the Notion pages where the Collaboratore formula is empty. Maybe you could remove the OR conditions in the Search Objects module, and use the ifempty() function instead. So, ifEmpty(ifEmpty(A;B);C), where A, B, C are your three Tally form fields mapped in the module

Thanks, but where do you suggest to put the ifempty formula?
The Notion search module only allows me to add filters on the Notion database properties.

Here

image

Now I get what you mean!
I never used ifempty.

So, I wrote this formula and it works, in part.

{{ifempty(toString(first(1.fields.`C-SPHERA SRL`)); 
ifempty(toString(first(1.fields.`P-SPHERA SRL`)); 
ifempty(toString(first(1.fields.`O-SPHERA SRL`)); 
ifempty(toString(first(1.fields.`D-SPHERA SRL`)); 
ifempty(toString(first(1.fields.`TREND SRL`)); 
toString(first(1.fields.`SPHERAHOLDING SRL`)))))))}}

As you can see every ifempty looks the same. But for D-SPHERA and SPHERAHOLDING it doesn’t work. I checked, and the corresponding values are present in the Notion database.

Any idea?

Solved it. I had to use Contains instead of Equals. I checked and the strings in Notions don’t have extraneous characters.
What else can make Equals fail?

2 Likes