Create a formula within the connector

Hi! I am setting up a connector to ingest data for an answer experience and I have a scenario where the name of the entity sometimes is the h1, some other times is the h2. The title is the h2 only for the pages that have “Help and Support” as an h1. I was wondering if there is a formula I can add for the transform to ask the connector to use the h2 column only when the h1 has “help and support” in its content.

Let me know if it’s clear,

Thanks for you support!

Federica

Hi Federica,

This is a bit tricky but it is possible! I’ve outlined the following transforms you’ll need to implement below:

  1. Find and Replace transform for h1 column to Replace “Help & Support” with “”
  2. Merge h1/h2 columns to a new column with a unique delimiter (I chose %)
  3. Use a function (I’ve written one locally on my computer, pasted below) to clear the row if it does not start with %. This file will need to be added to admin console as a plugin via the CLI in order to use it. You can reach out to me to complete this step if you need help. Your mod.ts file should contain the following code:

export function clearRow(row: string) { if (row.startsWith("%") == false) { var newRow = ""; } else { var newRow = row; } return newRow; }

Then, you can use this Function guide to get started.

  1. Remove % from remaining rows in the new column
  2. Merge h1 and new column to be one column with all the entity names

Hope this helps!
Best,
Rachel