Blog, Website & Page Publishing

ben-duchy
Top Contributor

if / or statement

SOLVE

Does anyone know if it's possible to create an if statement that covers multiple options for the page editior?

 

I have a created a tabbed module to be reused for our various homes to show floorplans and dimensions which are displayed within the relevant tab (first floor, second floor, third floor) .

 

Depending on the house type selected, 1, 2 or 3 tabs will show. I will then target that specific house name selection to pull in the correct data within each tab.

 

For example

{% if module.house_name =='Bodnant','Oakfield','Stratford' %}

    3 tabs displayed to represent each floor of a 3 storey - selected house name data displayed within each tab

{% elif module.house_name =='Wentworth','Thornbury','Windsor' %}

    2 tabs displayed to represent each floor of a 2 storey - selected house name data displayed within each tab

{% else %}

    1 tabs displayed to represent bungalow - selected house name data displayed within sole tab

{% endif %}

 

Unfortunately this doesnt work. Is there a workaround? Ideally I dont want to have multiple if statements to cover every house name.

0 Upvotes
1 Accepted solution
Kevin-C
Solution
Recognized Expert | Partner
Recognized Expert | Partner

if / or statement

SOLVE

Hey @ben-duchy 

 

You'll want to use the logical OR operator.

{% if module.house_name =='Bodnant' or module.house_name =='Oakfield' or module.house_name =='Stratford' %}

    3 tabs displayed to represent each floor of a 3 storey - selected house name data displayed within each tab

{% elif module.house_name =='Wentworth' or module.house_name =='Thornbury' or module.house_name =='Windsor' %}

    2 tabs displayed to represent each floor of a 2 storey - selected house name data displayed within each tab

{% else %}

    1 tabs displayed to represent bungalow - selected house name data displayed within sole tab

{% endif %}

 

Kevin Cornett - Sr. Solutions Architect @ BridgeRev

View solution in original post

2 Replies 2
Kevin-C
Solution
Recognized Expert | Partner
Recognized Expert | Partner

if / or statement

SOLVE

Hey @ben-duchy 

 

You'll want to use the logical OR operator.

{% if module.house_name =='Bodnant' or module.house_name =='Oakfield' or module.house_name =='Stratford' %}

    3 tabs displayed to represent each floor of a 3 storey - selected house name data displayed within each tab

{% elif module.house_name =='Wentworth' or module.house_name =='Thornbury' or module.house_name =='Windsor' %}

    2 tabs displayed to represent each floor of a 2 storey - selected house name data displayed within each tab

{% else %}

    1 tabs displayed to represent bungalow - selected house name data displayed within sole tab

{% endif %}

 

Kevin Cornett - Sr. Solutions Architect @ BridgeRev
ben-duchy
Top Contributor

if / or statement

SOLVE

That's Perfect @Kevin-C  just what I needed. Thanks 😀