How to set search in router in JSON (not by static number)

Hi, can you help, please? I cannot understand - how to set not the static number of the block, but that it checks whether there are such elements in at least one element.

Here is the structure of my JSON:

That is, in order not to specify statically what exactly block 4 (and block 1 and 2 in this block) should be looked at, but for it to check across all blocks whether there is such an element with such and such ID that has 2 child elements with such and such IDs

Hi @Alex330

Welcome to community.

I Couldn’t understand your query completely.
If you want to filter data based on a specific answerId in fewAnswers, just use the map and get functions within the filter.

If you require additional assistance, please don’t hesitate to reach out to us.
MSquare Support
Visit us here
Youtube Channel

2 Likes

Hi, @Msquare_Automation, thanks, I roughly understand how it should be done, but I don’t know how exactly to click it in Make. I just registered yesterday.

At the moment I found that I need an Iterator tool to first find if there is this block that I need (which has children that I need)

Then I do filtefing this block:

But then I still don’t understand how to check whether it has 2 values at once in
“fewAnswers”: [
{“answerId”: “1661430984679x377140851615727600”},
{“answerId”: “1661431006745x261322871392698370”}
]

Welcome to the Make community!

1. Scenario blueprint

Please export the scenario blueprint file to allow others to view the mappings and settings. At the bottom of the scenario editor, you can click on the three dots to find the Export Blueprint menu item.

Screenshot_2023-08-24_230826
(Note: Exporting your scenario will not include private information or keys to your connections)

Uploading it here will look like this:

blueprint.json (12.3 KB)

2. And most importantly, Output bundles

Please provide the output bundles of the modules by running the scenario, then click the white speech bubble on the top-right of each module, save the bundle contents in your text editor as a bundle.txt file, and upload it here into this discussion thread.
Screenshot_2023-10-06_141025

Providing the output bundles will allow others to replicate what is going on in the scenario even if they do not use the external service.

Following these steps will allow others to assist you here. Thanks!

3 Likes

Hi, @samliew, thanks, thats my files:
blueprint.json (59.1 KB)

2:

[
    {
        "lead_name": "Олександр",
        "lead_phone": "+380933333333",
        "lead_email": " ",
        "dialogue_id": "1703445228901x454288573712039940",
        "dialogue_name": "Новий діалог 5",
        "submitted_at": "26.12.23, 03:55",
        "qa": "1. ку 13 привіт \n2. Друге питання так \n3. Третє Далі →лалалалал \n",
        "steps": [
            {
                "questionId": "1703604620529x248197023830900740",
                "questionValue": "Привіт! Давайте знайомитись 👋",
                "questionNum": 1,
                "buttonType": "content-screen",
                "answerId": "1661272512255x918007587455631400",
                "answerValue": "Далі →"
            },
            {
                "questionId": "1661272203569x720168875848630300",
                "questionValue": "Який у вас тип бізнесу?",
                "questionNum": 2,
                "buttonType": "simple-buttons",
                "answerId": "1661431012119x885104400402481200",
                "answerValue": "Послуги / Консалтинг"
            },
            {
                "questionId": "1661435240397x793181335375839200",
                "questionValue": "Який у вас тип бізнесу?",
                "questionNum": 3,
                "buttonType": "simple-buttons",
                "answerId": "1661435240397x862404465647157200",
                "answerValue": "Для свого бізнесу"
            },
            {
                "questionId": "1661272176755x851058132495106000",
                "questionValue": "Яка задача для вас зараз найбільш актуальна?",
                "questionNum": 4,
                "buttonType": "cboxes",
                "fewAnswers": [
                    {
                        "answerId": "1661430984679x377140851615727600",
                        "answerValue": "Запустити продажі свого нового продукта"
                    },
                    {
                        "answerId": "1661431006745x261322871392698370",
                        "answerValue": "Пожвавити свій існуючий сайт"
                    },
                    {
                        "answerId": "1661430992756x893261380108419100",
                        "answerValue": "Автоматизувати комунікацію на сайті"
                    }
                ],
                "answerValue": "Далі →"
            },
            {
                "questionId": "1661621134664x942455454637752300",
                "questionValue": "Можна також додати довільну відповідь",
                "questionNum": 5,
                "buttonType": "input",
                "answerInput": "Це приклад довільної відповіді",
                "answerValue": "Далі →"
            },
            {
                "questionId": "1661621134664x942455454637752300",
                "questionValue": "Можна також додати довільну відповідь",
                "questionNum": 6,
                "buttonType": "slider",
                "answerSlider": [
                    {
                        "answerId": "1661432229951x859686930264621000",
                        "answerValue": "Ширина",
                        "answerSliderA": 20
                    },
                    {
                        "answerId": "1661432350622x811547628991676400",
                        "answerValue": "Бюджет",
                        "answerSliderA": 40,
                        "answerSliderB": 60
                    }
                ],
                "answerValue": "Далі →"
            },
            {
                "questionId": "1661272176745x215781307485782000",
                "questionValue": "Яка задача для вас зараз найбільш актуальна?",
                "questionNum": 7,
                "buttonType": "lead-form",
                "formInputs": [
                    {
                        "answerId": "1661430984679x377140851615727600",
                        "answerType": "name",
                        "answerValue": "Олександр"
                    },
                    {
                        "answerId": "1661431006745x261322871392698370",
                        "answerType": "phone",
                        "answerValue": "+380935556677"
                    },
                    {
                        "answerId": "1661430992756x893261380108419100",
                        "answerType": "email",
                        "answerValue": "hello@gmail.com"
                    }
                ],
                "answerValue": "Далі →"
            }
        ],
        "dialogue_url": "https://mysite.site/p/1703445228901x454288573712039940?utm_first=hello&utm_second=two&utm_three=something"
    }
]

Hi @Alex330

Create an array containing all the answerIds from the fewAnswers data (Use map function), and then filter using the array containment option, as shown below.
image

2 Likes

I see what you’re trying to do now.

Since only one of the questions has “fewAnswers”, why not just change your filter to this?

This way you do not have to mess with IDs.

2 Likes

@Msquare_Automation, @samliew I’m very thanks to you for your help, yes, I tried to click something and this option worked for me, did I do it right?

I will add a little to my description, that this JSON is only an example on which I train, and other JSONs can be very different, but I need to understand how I can configure a filter where several items are in a certain item. Is my variant ok or its not ok?

Is this an array? or I should create something on 2nd step (cant find)

After the iterator and please make sure map fewAnswer from iterator.

2 Likes


image
image

3 Likes

If other JSON (structures) can be very different, then are those items that you want to check for (answer and options) guaranteed to have exactly the same IDs in those other different JSON (structures)?

If no, then you might want to filter by questionValue and answerValue instead of using IDs.

2 Likes

yes, its work) thank you @Msquare_Automation
And thank you @samliew

2 Likes

@Alex330 I’m happy it worked for you, and I’m glad I could help with your work.

3 Likes