How do nested conditionals work in flows?
1

I am trying to make a nested condition in my Flow: "(${form.months} ​​​​== 1) || (${form.months} ​​​​== 2) but if I write it this way it does not validate any condition, instead if I write it like this simple (${form.months} ​​​​== 1) it works, what are you doing wrong?

Johana
تم طرح السؤال منذ حوالي شهرين
Johana

I'm following this documentation https://developers.facebook.com/docs/whatsapp/flows/reference/components#if but I don't understand why it doesn't work for me

‏٣٠ أغسطس‏‏١٠:٢٨ ص‏111
Bar

Can you please paste your entire Flow JSON? It would help debug

‏٣٠ أغسطس‏‏١٠:٣٦ ص‏111
الإجابة المحددة
1

Hi Johana,

The issue has been fixed. You can now use conditional rendering with "(${form.months} ​​​​== 1) || (${form. months} ​​​​== 2)".

Please verify and let us know if you are still facing this issue.

Thanks

‏٥ سبتمبر‏‏٥:٣٤ ص‏111
Sukhbir
الإجابة المحددة
1

I am not allowed to post the full json

‏٣٠ أغسطس‏‏١١:١٤ ص‏111
Johana
Johana
{
            "id": "PET_AGE",
            "title": "Edad",
            "terminal": true,
            "layout": {
                "type": "SingleColumnLayout",
                "children": [
                    {
                        "type": "Form",
                        "name": "pet_age_form",
                        "children": [
                            {
                                "type": "TextInput",
                                "label": "Escribe",
                                "name": "months",
                                "input-type": "number",
                                "required": true
                            },
                            {
                                "type": "If",
                                "condition": "(${form.months} == 1) || (${form.months} == 2)",
                                "then": [
                                    {
                                        "type": "TextBody",
                                        "text": "Lo sentimos, pero no podemos continuar con la información proporcionada"
                                    },
                                    {
                                        "type": "Footer",
                                        "label": "Regresar",
                                        "on-click-action": {
                                            "name": "complete",
                                            "payload": {}
                                        }
                                    }
                                ],
                                "else": [
                                    {
                                        "type": "TextBody",
                                        "text": "Good" 
                                    },
                                    {
                                        "type": "Footer",
                                        "label": "Continuar",
                                        "on-click-action": {
                                            "name": "complete",
                                            "payload": {}
                                        }
                                    }
                                ]
                            }
                        ]
                    }
                ]
            }
        }
‏٣٠ أغسطس‏‏١١:١٩ ص‏111
Sukhbir

Hello Johana, Thank you for reaching out. It appears that this is an issue on our end, and we are currently working to resolve it. In the meantime, as a temporary solution, could you try using a single point comparison in the if condition and then having another comparison in the else condition? I understand that this may require writing more JSON for your use case, but it should work for now. Please let us know if you have any further questions or concerns.

Also, I am adding the JSON for your reference.

‏١ سبتمبر‏‏٥:١٠ ص‏111
Sukhbir

{ "version": "5.0", "screens": [ { "data": { "value": { "type": "boolean", "example": true } }, "id": "SCREEN", "layout": { "type": "SingleColumnLayout", "children": [ { "type": "Form", "name": "pet_age_form", "children": [ { "type": "TextInput", "label": "Escribe", "name": "months", "input-type": "number", "required": true }, { "type": "If", "condition": "(${form.months} == 1)", "then": [ { "type": "TextBody", "text": "Lo sentimos, pero no podemos continuar con la información proporcionada" }, { "type": "Footer", "label": "Regresar", "on-click-action": { "name": "complete", "payload": {} } } ], "else": [ { "type": "If", "condition": "(${form.months} == 2)", "then": [ { "type": "TextBody", "text": "Lo sentimos, pero no podemos continuar con la información proporcionada" }, { "type": "Footer", "label": "Regresar", "on-click-action": { "name": "complete", "payload": {} } } ], "else": [ { "type": "TextBody", "text": "Good" }, { "type": "Footer", "label": "Continuar", "on-click-action": { "name": "complete", "payload": {} } } ] } ] } ] } ] }, "title": "Welcome", "terminal": true, "success": true } ] }

‏١ سبتمبر‏‏٥:١٠ ص‏111
Johana

Ok but there is a drawback since I need to specify that the client does not write 0, 1, 2 or 3 and if I nest this way I can only nest three times and not four. What can I do?

‏٢ سبتمبر‏‏٨:٥٣ ص‏111