Modify a Left - formula

Hi

I have two automations.

  • One is to link an Afspraak entity to a Event type.
  • If Afspraak can not be linked, because there’s no Event type matching the criteria a new Event Type need to be created.

This is where automation number 2 gets triggered.

  • The name of Afspraak looks something like this: New event - 10 mei 2023 om 16:00 uur
  • The name of Event type should be New event

For that I’m using the following formula:

Left([Step 1 Afspraak].Name,(Length([Step 1 Afspraak].Name) - Find([Step 1 Afspraak].Name,“-”)) - 1)

But instead of New event the result is New event - 10 mei 202.

As you can see, the -1 from the formula is applied, but in the wrong place. It should remove the space before -. Is this due to a mistake in my formula setup, due to a bug or something else?

Thanks

Perhaps it would be simpler to use ReplaceRegex to trim the " - " substring and everything after it:

ReplaceRegex( [Step 1 Afspraak].Name, " - .*", "" )
1 Like

I think you need this:

You were trimming to return only the number of characters equal to the length minus the position of the hyphen, minus 1.
You just need to trim to return the number of characters equal to the position of the hyphen minus 2.
(assuming the hyphen is always preceded with a space)

@Matt_Blais Yes, this does exactly what I was looking for! Didn’t know this function yet. Wondering how long it will happen untill I’m aware of all possibilities within Fibery. :nerd_face: