TeamDesk Knowledge Base & Support

   Home      FAQ      Forum      Idea Exchange      Ask a Question      My Stuff      Help   
  
URL Slug Formula
Hi
The idea is simple...
A formula to create a URL Slug from a field that may contain characters that are not compatible with a web URL Slug...

e.g. [Column] = 'Wonky Donkey Back Splint For Sale | (Does not include Donkey)

Formula would remove spaces, and any other non compatible characters automatically to give an answer like so....

wonkey-donkey-back-splint-for-sale-does-not-include-donkey

It could be made to add numbers at the end to prevent duplicates...and you could set a max. length limit...

e.g.
UrlSlug([Column1),PreventDuplicatesBoolean,MaxCharacterLength)
UrlSlug([Column1],true,120)

Get voting folks! Gotta be a useful function this one.

Regards

Jonathan
ID
2013
Category
Setup
Author

Jonathan Gee
Date Created
10/3/2023 9:41:00 AM
Date Updated
10/12/2023 11:27:19 AM
Status
New Idea
Score
30
Promoted By
Patricio Bustoscooper collier Jonathan Gee
Comments
cooper collier  10/3/2023 9:43:37 AM
drats, hit the promote button
Have you considered using a regex to accomplish this?


Jonathan Gee 10/11/2023 5:23:47 AM
Hahaha. Drats. Not heard that word in a long long time.

Go on then.. Whats Regex? lol

More I seem to learn on here the less I seem to know.. haha
cooper collier  10/12/2023 11:27:19 AM

Of course Regex may not be the solution you need. I know that I could likely write a formula to do what you wish, but it would be a very complicated one. Regex was designed to make this "simpler, so if you can use it.. great.

Regex is just a way to make complex patterns. There is no way for me to teach regex here and it is not needed. What you do is go to the regex library and find a pattern that work for you already. Maybe tweak it a small amount.

Here is the link to the regex library with a search for URL
https://regexlib.com/(X(1)A(AhWLGbgMu8taobAybln49yZTImT4zOn5Do2cvkHyVMDwj996Mj0o4pypXmPrnWcBG3OAEVYgb_nC7MrrrlYF9VV0QCGtpCPes8JQXKKCuRPonbD4H5FgqPveG9n_Pg3nNh_iwk_F4SF4wFyz9OuOxSsqv3d5YVB3Jcw1ZyuWMT43UMqx3xyOOainIK3N60GH0))/Search.aspx?k=URL+&c=-1&m=-1&ps=20

This works in text columns, towards the bottom of a text collum setup there is a Validation check box. Checking that you can add a Validation pattern. It accepts Regex expressions. If you are using multiple columns and combining them into your URL Slug, You can use regex to make sure people enter the correct format in each.

Another way to use it is to replace characters, Here I am a bit... well, a LOT foggy. I have not done this in Teamdesk. Maybe you can use it in a formula maybe not. You can however use it in JavaScript, and you can write JavaScript in resource section in teamdesk. This is the first google result on how to use regex to replace in JavaScript

https://bobbyhadz.com/blog/javascript-replace-multiple-characters-in-string#:~:text=Use%20the%20replace()%20method,that%20can%20match%20multiple%20characters.


I hope that gets you started.






Feedback
 
Back to Search Results