I want to name a big formula, but there is an error

{if: contains({site: url}, "front"); trim=yes}

{fullname_front={site: text; page=https://frontcrm.wts.chat/*; selector=.contact-name}}{=proper({=split(fullname_front, " ")[1]}); trim=no}

{elseif: contains({site: url}, "whats"); trim=yes}

{fullname_zap={site: text; page=https://web.whatsapp.com/*; selector=#main .xuce83p}; trim=no}
{=proper({=split(fullname_zap, " ")[1]}); trim=no}

{elseif: contains({site: url}, "clint"); trim=yes}

{fullname_clint={site: text; page=https://app.clint.digital/*; selector=.border-left > .container > .container .text-left}; trim=no}
{=proper({=split(fullname_clint, " ")[1]}); trim=no}

{endif: trim=yes}

That's the formula. I just wanted to name it, like, {formula= {the formula above here}}

but the hole formula gets red with an error below.

Hi @Marco_Gouveia,

If you want to name this block, then you can create a separate snippet for it & then import that snippet to any other snippet.

For example, you can place this block inside another snippet (e.g., /url-info) and use it in any other snippet with the import snippet option as:

{import: /url-info}

For more details, check out: Text Blaze | {import}

Best,
Pratham

Hi @Pratham_Thakkar !! Thank you so much for your reply!

So, this is snip A: 'CLQ

{if: contains({site: url}, "front"); trim=yes}

{fullname_front={site: text; page=https://frontcrm.wts.chat/*; selector=.contact-name}; trim=yes}{=proper({=split(fullname_front, " ")[1]}); trim=no}

{elseif: contains({site: url}, "whats"); trim=yes}

{fullname_zap={site: text; page=https://web.whatsapp.com/*; selector=#main .xuce83p}; trim=yes}
{=proper({=split(fullname_zap, " ")[1]}); trim=no}

{elseif: contains({site: url}, "clint"); trim=yes}

{fullname_clint={site: text; page=https://app.clint.digital/*; selector=.border-left > .container > .container .text-left}; trim=yes}
{=proper({=split(fullname_clint, " ")[1]}); trim=no}

{endif: trim=yes}

This is B: 'CLE

{if: contains({import: 'CLQ}, "�"); trim=yes}

{formtext: name=nome corrigido}

{if: len(nome corrigido) = 0; trim=yes}

{error: Inserir nome; block=yes}

{endif: trim=yes}{else: trim=yes}

{=proper({import: 'CLQ; trim=no})}

{endif: trim=yes}

(it appears to have some problem here in the snippet block, but on de dashboard woks fine)

The following error appears:

And if I try to ALSO bring the named blocks on Snip A, to B... Like this:

{fullname_front={site: text; page=https://frontcrm.wts.chat/; selector=.contact-name}; trim=yes}
{fullname_zap={site: text; page=https://web.whatsapp.com/; selector=#main .xuce83p}; trim=yes}
{fullname_clint={site: text; page=https://app.clint.digital/
; selector=.border-left > .container > .container .text-left}; trim=yes}

{if: contains({import: 'CLQ}, "�"); trim=yes}

{formtext: name=nome corrigido}

{if: len(nome corrigido) = 0; trim=yes}

{error: Inserir nome; block=yes}

{endif: trim=yes}{else: trim=yes}

{=proper({import: 'CLQ; trim=no})}

{endif: trim=yes}

The following happens:

Hi @Marco_Gouveia,

The import command doesn’t support string functions directly. If you want to reuse this code block, then you can make function that contains blocks. You can place that function inside a snippet, and then import that snippet and reuse that function anywhere you need.

For your specific use case, you can do the following:

In snippet /url-info:

{getUrlInfo=() -> block
if contains({site: url}, "front")
fullname_front={site: text; page=https://frontcrm.wts.chat/; selector=.contact-name}
return proper({=split(fullname_front, " ")[1]})
elseif contains({site: url}, "whats")
fullname_zap={site: text; page=https://web.whatsapp.com/
; selector=#main .xuce83p}
return proper({=split(fullname_zap, " ")[1]})
elseif contains({site: url}, "clint")
fullname_clint={site: text; page=https://app.clint.digital/*; selector=.border-left > .container > .container .text-left}
return proper({=split(fullname_clint, " ")[1]})
endif
endblock}

Then in /url-1, you can use:

{import: /url-info}

{=getUrlInfo()}

{if: contains(getUrlInfo(), " ")}Inside the If{else}In the else{endif}

Please refer to Text Blaze | Code Blocks Reference for more details.

Best,
Pratham