I am trying to extract the domain name from a URL field for a report.

  • 0
  • 1
  • Question
  • Updated 3 years ago
  • Answered

I have come up with following IF statements which I think can be combined in to one formula :

If(Contains(Left([DomainText],8),"https://"), NotLeft([DomainText],8),  [DomainText])

If(Contains(Left([DomainText],12),"https://www."), NotLeft([DomainText],12),  [DomainText])

If(Contains(Left([DomainText],7),"http://"), NotLeft([DomainText],7),  [DomainText])

If(Contains(Left([DomainText],11),"http://www."), NotLeft([DomainText],11),  [DomainText])

If(Contains(Left([DomainText],4),"www."), NotLeft([DomainText],4),  [DomainText])

Additionally, I am not sure how to use TRIM or NotRight to end the domain name after .com or .org or .net when the length is variable.

Any and all help appreciated,

Jane





Photo of Jane_Ryan

Jane_Ryan

  • 0 Points

Posted 3 years ago

  • 0
  • 1
Photo of Steven

Steven

  • 0 Points
"Part()" separates a string of text into different parts based on a delimiter. 


For the URL of this page,

Part([Domain Text],3,"/") = quickbase-community.intuit.com


That is taking the 3rd section where a new section starts at every "/". "https:" is the 1st. Then a blank section because two "/" are next to each other. Then "quickbase-community.intuit.com" is the 3rd.

Part(Part([Domain Text],3,"/"),1,".") = quickbase-community


Part(Part([Domain Text],3,"/"),2,".") = intuit

Part(Part([Domain Text],3,"/"),3,".") = com


This formula is taking the part of the URL "quickbase-community.intuit.com" and splitting it up into sections based on where the "." is. The 1st section is "quickbase-community". The 2nd is "intuit". The 3rd is "com"


I'm not sure what parts you're looking for, but I would start here.
Photo of Jane_Ryan

Jane_Ryan

  • 0 Points
Thank you Steven!
Basically, I need to create a field that reduces advertisement URLs to (using your example) "quickbase-community.intuit.com".
The issue is that I have a mix of URLs where I don't know if they begin with http:// or https:// and I then don't know if they also use www.
The suggestion you made worked beautifully for about 50% of the URLs which did not include www. but for the remaining 50%, the results contained the www.
Any suggestion on how I might adapt your formula to account for this?
Best,
Jane
Photo of Steven

Steven

  • 0 Points
Oh OK, No problem.

You can add an "if" statement that checks for "www" and, if it's there, it lops it off.

If(Contains([Notes],"www"), NotLeft(Part([Notes],3,"/"),"."),Part([Notes],3,"/"))

Hopefully that will work for you.
Photo of Jane_Ryan

Jane_Ryan

  • 0 Points
Perfect!! Thank you so much :-)