Save the date! Join us on October 16 for our Product Ops launch event. Register here.
Aug 10, 2021 01:32 PM
I’m working on a character generator for Dungeons and Dragons and I’m having trouble building a formula to get all the information in one place.
This is the view on the form I created:
My goal is to create a formula that get rid of the numbers and just displays what Race the player selected (elf, dragonborn, etc.) for easier readability in grid view.
When I write the formula to only refer to a single number it works fine.
But when I try and have the formula substitute multiple numbers with a blank space it returns an error message.
I was using the example formula on the side as a reference which uses => instead of a comma to separate the value being substituted with the new value but that didn’t make a difference. I’m pretty sure I copied the format of the example correctly otherwise so I’m not sure what I’m doing well.
I have no experience programming, I’m just teaching myself as I go along so any help/advice would be extremely appreciated. Thank you!
Aug 10, 2021 02:53 PM
Hi there! Try this:
REGEX_REPLACE({Race (d12)}, "\\d+\\.\\s", "")
This formula uses regular expressions to replace combination of number, period and empty space with a given string (in our case empty string “”).
Aug 10, 2021 02:56 PM
Hi Tom. Just wondering why you numbered them in the first place? The numbers don’t signify anything do they?
Aug 10, 2021 02:57 PM
Hey augumented, I numbered them because it’s basically a table for people to roll on during character creation. So they’d roll a 12 sided die for race.
Aug 10, 2021 02:58 PM
Thanks Ela I tried it and it works!!!