Transform rule to merge columns only if they both have content

Hi,

I set up a connector for one of my clients and I am mapping images as well. The selector for the images is pulling in only the URL path and not the entire URL. So, I added a new column with the main domain and then I added a transform to merge the main domain column and the URL path. However, some URL paths are empty as those pages don’t have an image in them. As a result, for those entities, the connector fails as the URL is not correct.
My question here is: can we set up a formula in the connector to merge columns only if they both have content, otherwise keep them empty?

A possible workaround is adding use find and replace to add a placeholder URL path where there is no content, however, it would be great to understand if there is any other solution to this situation. Indeed, the workaround works only if the domain of the placeholder image is the same one as the other images (which couldn’t be always the case).

Thanks,

Federica

Hi Federica,

Unfortunately, we do not have a built in transform yet that can perform conditional logic. However, you should be able to write a function transform to accomplish this.

For example, if you added some sort of unique text to URLs where the image is not present, such as by filling in empty cells with “NOIMAGE” or something of the sort, you could write a function that takes in the final image URL and performs logic such that,
“IF the URL contains “NOIMAGE” clear the value”.

Here is an example of a function accomplishing a similar task!

Also, I recommend checking out our HH guides to get started using Functions: see here and here!

Hope this helps!

Best,
Rachel

1 Like