IF/Else function check for specific word(s)/text

Hi,
very new to TB, but loving what it can offer.

I'm struggling to work this out, but I assume it will be simple once I see it.

I want my snippet to look at text from a website field ( I have used the Select from Website function and named it "extractedText"). I believe I have done this correctly.

I have then added an IF/Else function and what it to look at the text from the "extractedText" and see if contains any of the word "Chronic" or "Chronic Pain"

For my testing, I have simply asked it to reply with a Yes or No answer.

It returns the below, referring to being unable to convert the extracted text to a number

[Error - Cannot convert "Chronic Back, Shoulder, Arm, Neck, Foot, Leg, Knee, Hip, ElbowPain due to
Right Shoulder Rotator Cuff Syndrome
Left Shoulder Rotator Cuff Syndrome
Lumbar Spondylosis" to a number.]

Can the IF/Else function evaluate text?

Many thanks in advance : )

Hi @andrew.dowdle
The if formula should be:
{if: contains(extractedText, "Chronic")}Yes {else} No{endif}

There's no point in checking for both "Chronic" and "Chronic Pain" since the first is a prefix of the second, but if you wanted to do it, you would do it like this:

{if: contains(extractedText, "Chronic") or contains(extractedText, "Chronic Pain")}Yes {else} No{endif}

Thanks Dan for the help. Copying your formula has made it work !

For my benefit (and maybe someone ese who views this) I reversed engineered the formula using the insert function. This looks like it to me

Thanks again

1 Like