IF command with CSS selector

Hi everyone, I was wondering if you have any ideas on how to make this work.

I'm using a CSS selector to extract the name of my subject. However, there are instances where 'NO NAME' appears instead of the actual name. I want to create a command that triggers a text field when 'NO NAME' is detected, allowing me to manually input the name. Otherwise, if a valid name is extracted, the normal process should proceed as usual.

Currently stuck with this WIP

Thanks in advance for your input!

Hi,

Could you copy and paste the content of the snippet and send it in this thread? I would like to be able to test it out myself and get back to you. Thanks!

Yea sure

{={site: text; page=https://apps.mypurecloud.com.au/; select=ifneeded; selector=.header-text-container}}
{if: contains (fn,"No Name")}{formtext: name=NAME OF THE CHATTER}{else}{={site: text; page=https://apps.mypurecloud.com.au/
; select=ifneeded; selector=.header-text-container}}{endif}

Thanks! Testing it out now. Will let you know when I figure out more

Hi,

So I was able to test the snippet and I have a few comments. First, if you set the CSS selector equal to a variable it's easier to use conditional logic on it. Second, if "NO NAME", is the only edge case, you don't need to use contains and can simply use equals. I tested the logic on the weather app since I don't have access to the exact site you used. Here is my snippet:

{name={site: text; page=https://www.wunderground.com/*; selector=.conditions-circle-wrap .wu-value-to}}
{if: `name` = "55"}{formtext: name=NAME OF THE CHATTER}{else}{=name}{endif}

I set name equal to the CSS selector, then I asked if name was equal to a certain value, then I just paste the name variable based on the else condition. Let me know if this works for you as well. Thanks!

Thanks, Alexander. I appreciate you taking the time to share your ideas with me. Unfortunately, they didn’t work as we had hoped

Hi, Gerald. Sorry it didn't work as expected. Is there any other way I can help you?

Hi @Gerald_John_Amora ,
To add to Alexander, does something like this works?

{name=catch({site: text; page=https://apps.mypurecloud.com.au/ ; select=ifneeded; selector=.header-text-container}, "No Name")}
{if: contains(name, "No Name")}{formtext: name=NAME OF THE CHATTER}{else}{=name}{endif}