Remove @company.com characters from string field

2035
6
Jump to solution
10-12-2017 08:21 PM
katshier
New Contributor III

My form is capturing the username by default which is the full email address. I would like to remove the @company.com so that I'm just left with firstname.lastname in a field called 'User'.

I have looked at using an input mask, regex and a calc along the lines of substr(${username},-21) but haven't quite cracked it. I would imagine this would be quite a common requirement?

The email address would always be in the same format. 

Any suggestions welcome! 

 

1 Solution

Accepted Solutions
JamesTedrick
Esri Esteemed Contributor

Hi Katherine,

It sounds like your organization uses enterprise logins- technically, the `@companyname` is part of the username as ArcGIS receives it from your login system.

The substr() function can be used to do this, but it requires the start and end points for the text you want to extract.  The start point is 0 (the beginning); the end point can be calculated by subtracting the length of the `@companyname` part from the total length of username.  In your case, it looks like that part is 21 characters long; you would have

substr(${username}, 0, string-length(${username})-21)

View solution in original post

6 Replies
JamesTedrick
Esri Esteemed Contributor

Hi Katherine,

It sounds like your organization uses enterprise logins- technically, the `@companyname` is part of the username as ArcGIS receives it from your login system.

The substr() function can be used to do this, but it requires the start and end points for the text you want to extract.  The start point is 0 (the beginning); the end point can be calculated by subtracting the length of the `@companyname` part from the total length of username.  In your case, it looks like that part is 21 characters long; you would have

substr(${username}, 0, string-length(${username})-21)

katshier
New Contributor III

That's great, thanks James. That's exactly what I wanted.

0 Kudos
DanielMcIlroy
Occasional Contributor

Hi James, I have a related problem (and it is similar to one that I've had previously https://community.esri.com/thread/204180-find-and-replace-character )

So I need my responses to fit some very strict business rules regarding usernames, I was able to trim off the @companyname, but i need to replace the "." symbol between firstname.lastname, as the database strictly requires a firstname[space]lastname format.

I know that we previously solved a find and replace problem with some fancy footwork around changing decimals to integers, and creating a concatenated string, but this i think is a straight up find and replace problem i think. I have been trying to figure out of regex is the way to go, but put simply, my regex is atrocious!!

Hope you can help

Cheers

Dan

0 Kudos
JamesTedrick
Esri Esteemed Contributor

Hi Dan,

Doing a replacement in the middle of the string is a bit harder.  There is a capability in beta that can address this though - Welcome to our Feedback Community is the link to that documentation.

0 Kudos
RobertAnderson3
MVP Regular Contributor

Hi James,

The link you posted for this in the beta forum no longer works, is there a post now that shows this capability now that it has likely gone live?

0 Kudos
by Anonymous User
Not applicable

Could you please post an example of this? 

0 Kudos