Submitted by desbest on 2023/10/05 05:25

How can I use the replace() conditional formatting to change "watch" to "embed" automatically within my AutoEmbed field.

I tried reading the documentation but I couldn't get it to work, as the command's syntax wasn't well defined.

infoqube my grid 2

 

M:AutoEmbed=replace(ucase([URL])|E:AutoEmbed="the url is empty"
A:AutoEmbed=ucase([URL])

Comments

Hi,

Remember that conditional formatting is just "formatting". It does not modify the actual data.

Are you sure this is what you want?

if not, an auto-assign rule is your best bet: AM:[AutoEmbed]=UCase([URL]) | E:[AutoEmbed]=

This isn't what conditional formatting was designed for. It is for "formatting"...

Plus, what would you do with the modified text? Can you explain in more detail and why an auto-assign rule wouldn't work for you

HTH!

Pierre_Admin
IQ Designer

I would like to convert a youtube URL into a youtube embed.

Here is the embed code that youtube gives for embedding a video, with nothing modified by the user.

 

<iframe width="560" height="315" src="https://www.youtube.com/embed/VQlXIR__Dho" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" allowfullscreen></iframe>

 

Which can then be shortened to

<iframe width="560" height="315" src="https://www.youtube.com/embed/VQlXIR__Dho"></iframe>

 

You can then see why I want to replace "watch" with "embed".

Which'll then make it easier for me to figure out how to change that URL to the proper one.

The ?si= parameter can be ignored as it's just Youtube's ways of tracking shares.

You can then see why I want to replace "watch" with "embed

sort of... but still I don't see why conditional formatting is superior to auto-assign rules. With the latter, you'd get a real field which you could copy / paste / hyperlink, etc 

I can see where the confusion is now.

I can accept that it would be best to use conditional formatting to achieve my desired task, rather than auto-assign rules. But even so, how do I use the replace() syntax as I've tried my attempt of it, after looking at the documentation specified and it didn't work.

infoqube auto assign rules

 

My attempt doesn't work.

AM:[AutoEmbed]=UCase([URL]) | E:[AutoEmbed]='the url is empty

[AutoEmbed] replace "WATCH" with "EMBED"

Functions like upper and replace can only be used in the criteria column of the conditional format. Again, the purpose of conditional formatting is just to change the format, not to do replace text with another

For auto-assigns, there is a function reference here: 7. Visual Basic Editor. The function you want is Replace. For something more fancy, you can write a user-defined function

How do I ?