Concat string help - InfoPath Dev Sign in | Join | Help in Controls InfoPath (Entire Site) InfoPath Dev InfoPath Dev is dedicated to bringing you the information and tools you need to be successful in your Microsoft Office InfoPath development projects. Home Blogs Forums Photos Downloads InfoPath Dev » InfoPath » Controls » Concat string help Use our Google Custom Search for best site search results. Concat string help Last post 09-08-2014 02:29 AM by davedmonds. 26 replies. Page 1 of 2 (27 items) 1 2 Next > Sort Posts: Oldest to newest Newest to oldest Previous Next 05-03-2007 11:58 AM Sharksfan Joined on 08-27-2006 USA Posts 30 Concat string help Reply Contact I am having difficulty parsing out the first and last names from an email address into a person's name. I have a field Submitter_email and when a user enters his/her email address I would like to then take that data and enter a First and Last name into another field by concatenating text from the Submitter_email field.For example: mickey.mouse@google.com would equate to Mickey Mouse in the name field Here is what I came up with, but it doesn't quite work because I can't work out how to exclude the part of the address from the @ sign. Anyway to capitalize the first letters of the name so that I end up with Proper name formatting as well, this part is not critical.concat(substring-before(".", Submitter_email)," ",(substring-after(".", Submitter_email))Thanks 05-03-2007 01:45 PM In reply to Clay Fox Joined on 06-27-2006 USA Posts 1,935 Re: Concat string help Mark as Not AnswerMark as Answer... Reply Contact This is kind of fun.Here is the formula.concat(translate(substring(Submitter_email, 1, 1), "abcdefghijklmnopqrstuvwxyz", "ABCDEFGHIJKLMNOPQRSTUVWXYZ"), substring-after(substring-before(Submitter_email, "."), substring(Submitter_email, 1, 1)), " ", translate(substring(substring-after(substring-before(Submitter_email, "@"), "."), 1, 1), "abcdefghijklmnopqrstuvwxyz", "ABCDEFGHIJKLMNOPQRSTUVWXYZ"), substring-after(substring-after(substring-before(Submitter_email, "@"), "."), substring(substring-after(substring-before(Submitter_email, "@"), "."), 1, 1)))I used it as the default for the name field but you probably want to use it as a set field value rule. I would do a check probably and make sure the email is formatted right so that you do not end up with garbage.To explain, you can nest your substring formulas to get the correct substring, this can get complex but you have to work from the inside out. So the first piece I get the first letter in the string and translate it to a capital. Then I concatenante that with the whole first name (before the ".") and after the first letter. Then I concatenate a space and use a nested after/before to get the string before the @ and after the . which would be the last name and repeat.Then the translate function is nice to change the capitalization. I have used it before with data that had been entered in all caps, to convert it for string comparisons.Good Question Clay Fox / Microsoft InfoPath MVP Filed under: concatenation translate capitalization 05-03-2007 02:17 PM In reply to Sharksfan Joined on 08-27-2006 USA Posts 30 Re: Concat string help Mark as Not AnswerMark as Answer... Reply Contact What can I say, but ....Wow! Thanks for this Clay. Just to type it out must have taken a good 5 min :)I'll try it out and let you know how it works out. I had no clue about the Translate function so I defintely upped my knowledge there as well. 05-03-2007 02:21 PM In reply to Clay Fox Joined on 06-27-2006 USA Posts 1,935 Re: Concat string help Mark as Not AnswerMark as Answer... Reply Contact If you use the Insert Function button and copy and paste it doesn't take that long. And actually doing it inside a form ensured I had it right. Glad to help and I think there are lots of people who are not aware of how to accomplish this. I may create a blog post and use some color to make it a little easier to figure out. Clay Fox / Microsoft InfoPath MVP 05-03-2007 02:24 PM In reply to Clay Fox Joined on 06-27-2006 USA Posts 1,935 Re: Concat string help Mark as Not AnswerMark as Answer... Reply Contact Also you will need to reupdate the field name. Paste my text in and then select Insert Field on the first one and select your field. Then you can copy and paste it through out the rest. Clay Fox / Microsoft InfoPath MVP 05-03-2007 02:54 PM In reply to Sharksfan Joined on 08-27-2006 USA Posts 30 Re: Concat string help Mark as Not AnswerMark as Answer... Reply Contact Thanks a ton Clay! It worked great. As you suggested I used this function in conjunction with a Rule that sets the Name field value when specific conditions are met. 11-20-2007 02:11 PM In reply to ErnestoM Joined on 08-27-2007 Posts 3,320 Re: Concat string help Mark as Not AnswerMark as Answer... Reply Contact Follow up: For the function concat in Infopath, how can I include a double-quote? I tried escaping the character, but that doesn't work. I need this in order to dynamically create a query string for filtering with EnumDB. Thanks! Ernesto MachadoQdabra® Software/ InfoPathDev.comThe InfoPath Experts – Streamline data gathering to turn process into knowledge.™ 11-22-2007 03:51 AM In reply to adamrharding Joined on 12-07-2005 United Kingdom Posts 216 Re: Concat string help Mark as Not AnswerMark as Answer... Reply Contact Hi """ might work or try putting the " in a field and referencing it in the formula Cheers Adam HardingWalesUK 02-08-2008 01:51 PM In reply to 3lias Joined on 02-08-2008 Posts 1 Re: Concat string help Mark as Not AnswerMark as Answer... Reply Contact Thanks for this! Not exactly what I was looking for, but definitely set me on the right path! 08-09-2008 02:25 PM In reply to mstratan Joined on 08-09-2008 Posts 1 Re: Concat string help Mark as Not AnswerMark as Answer... Reply Contact Hello, This is really great. Only it doesn't work if I try to update the same field. Actually, I'm looking into formatting a field so that all words (no matter how many), get their first letter capitalized. (Like In This Example). Any help is greatly appretciated. Thanks in advance, Mircea 01-15-2009 08:18 AM In reply to nwade Joined on 12-19-2008 Posts 2 Re: Concat string help Mark as Not AnswerMark as Answer... Reply Contact This is awesome....and I was really excited to get it working on my form...all the way up until I previewed my form. My scenario is similar however not exactly like yours. Could you possible shed some light on what I might need to do . Here's the scoop: I have a contact selector control and two hidden txt fields on my form. The two txt fields are hidden and hopefully will hold the First Name portion of the extracted DisplayName (of contact selector value) and the second txt field will hold the last name. As you probably already know...the DisplayName value of contact selector displays as [LastName],[FirstName]. What I'm doing for now is to just try and get a successful parse so I'm setting the default value of the hidden txt field to be the value obtained using your highly complex and impressive concat statement. So to try and simplify...instead of parsing out the email address of the contact selector control value, I need to parse out and separate the DisplayName portion of the contact selector control value (which displays Lastname,Firstname). NOTE: I was able to get the last name to appear in the hidden txt field by using: concat(translate(substring(DisplayName, 1, 1), "abcdefghijklmnopqrstuvwxyz", "ABCDEFGHIJKLMNOPQRSTUVWXYZ"), substring-after(substring-before(DisplayName, ","), substring(DisplayName, 1, 1)), " ", translate(substring(substring-after(substring-before(DisplayName, "@"), ","), 1, 1), "abcdefghijklmnopqrstuvwxyz", "ABCDEFGHIJKLMNOPQRSTUVWXYZ"), substring-after(substring-after(substring-before(DisplayName, "@"), "."), substring(substring-after(substring-before(DisplayName, "@"), "."), 1, 1))) I hope this makes sense and you or someone can help cuz the ability to get this working drives whether a form of ours gets put into production or not. Thank you in advance for any help. Filed under: Contact selector control, concat 01-15-2009 10:03 AM In reply to Alec Pojidaev Joined on 12-16-2008 Posts 163 Re: Concat string help Mark as Not AnswerMark as Answer... Reply Contact In most companies DisplayName is capitalized already. So your expression should be much simplier. For example LastName: substring-before(DisplayName," ") FirstName: substring-after(DisplayName," ") http://alecpojidaev.wordpress.com/ 01-15-2009 11:04 AM In reply to nwade Joined on 12-19-2008 Posts 2 Re: Concat string help Mark as Not AnswerMark as Answer... Reply Contact Hi Alec, Could you help me by maybe filling in the blanks for me....I'm a rookie at all of this just trying stuff as I go. Unfortunately not a lot of it makes sense to me: so per your suggestion I should have the following?concat(translate(substring-before(DisplayName," "))) - which is to get the last name...and then a separate one:concat(translate(substring-before(DisplayName," "))) - to get the first name....but how would I go about putting them together. I tried applying your response and the forumla checker kept erroring on the "LastName" and "FirstName" parts. 01-15-2009 11:40 AM In reply to Alec Pojidaev Joined on 12-16-2008 Posts 163 Re: Concat string help Mark as Not AnswerMark as Answer... Reply Contact The LastName and FirstName are your hidden fields they are not part of the formula. And here are the expressions to set your hidden fields to the new values. You will need two separate actions for each of your field. substring-before(DisplayName," ") - which is to get the last name... substring-after(DisplayName," ") - to get the first name http://alecpojidaev.wordpress.com/ 06-15-2009 01:19 AM In reply to apgcng Joined on 06-15-2009 Posts 2 Re: Concat string help Mark as Not AnswerMark as Answer... Reply Contact Hi, I have a similar issue Displayname is Lastname, Firstname (XX) Need to parse out the email address - Firstname.Lastname@domain.com Got most of it working from the posts here but now need to parse out firstname without the (XX) (note that XX is a two character country code) Page 1 of 2 (27 items) 1 2 Next > Copyright © 2003-2019 Qdabra Software. All rights reserved.View our Terms of Use.
Use our Google Custom Search for best site search results.
I am having difficulty parsing out the first and last names from an email address into a person's name. I have a field Submitter_email and when a user enters his/her email address I would like to then take that data and enter a First and Last name into another field by concatenating text from the Submitter_email field.
For example: mickey.mouse@google.com would equate to Mickey Mouse in the name field
Here is what I came up with, but it doesn't quite work because I can't work out how to exclude the part of the address from the @ sign. Anyway to capitalize the first letters of the name so that I end up with Proper name formatting as well, this part is not critical.
concat(substring-before(".", Submitter_email)," ",(substring-after(".", Submitter_email))
Thanks
This is kind of fun.
Here is the formula.
concat(translate(substring(Submitter_email, 1, 1), "abcdefghijklmnopqrstuvwxyz", "ABCDEFGHIJKLMNOPQRSTUVWXYZ"), substring-after(substring-before(Submitter_email, "."), substring(Submitter_email, 1, 1)), " ", translate(substring(substring-after(substring-before(Submitter_email, "@"), "."), 1, 1), "abcdefghijklmnopqrstuvwxyz", "ABCDEFGHIJKLMNOPQRSTUVWXYZ"), substring-after(substring-after(substring-before(Submitter_email, "@"), "."), substring(substring-after(substring-before(Submitter_email, "@"), "."), 1, 1)))
I used it as the default for the name field but you probably want to use it as a set field value rule. I would do a check probably and make sure the email is formatted right so that you do not end up with garbage.
To explain, you can nest your substring formulas to get the correct substring, this can get complex but you have to work from the inside out. So the first piece I get the first letter in the string and translate it to a capital. Then I concatenante that with the whole first name (before the ".") and after the first letter. Then I concatenate a space and use a nested after/before to get the string before the @ and after the . which would be the last name and repeat.
Then the translate function is nice to change the capitalization. I have used it before with data that had been entered in all caps, to convert it for string comparisons.
Good Question
What can I say, but ....Wow! Thanks for this Clay. Just to type it out must have taken a good 5 min :)
I'll try it out and let you know how it works out. I had no clue about the Translate function so I defintely upped my knowledge there as well.
If you use the Insert Function button and copy and paste it doesn't take that long. And actually doing it inside a form ensured I had it right.
Glad to help and I think there are lots of people who are not aware of how to accomplish this.
I may create a blog post and use some color to make it a little easier to figure out.
Thanks a ton Clay! It worked great.
As you suggested I used this function in conjunction with a Rule that sets the Name field value when specific conditions are met.
Follow up: For the function concat in Infopath, how can I include a double-quote? I tried escaping the character, but that doesn't work. I need this in order to dynamically create a query string for filtering with EnumDB.
Thanks!
Hi
""" might work or try putting the " in a field and referencing it in the formula
Cheers
Thanks for this! Not exactly what I was looking for, but definitely set me on the right path!
Hello,
This is really great. Only it doesn't work if I try to update the same field.
Actually, I'm looking into formatting a field so that all words (no matter how many), get their first letter capitalized. (Like In This Example). Any help is greatly appretciated.
Thanks in advance,
Mircea
This is awesome....and I was really excited to get it working on my form...all the way up until I previewed my form. My scenario is similar however not exactly like yours. Could you possible shed some light on what I might need to do . Here's the scoop:
I have a contact selector control and two hidden txt fields on my form. The two txt fields are hidden and hopefully will hold the First Name portion of the extracted DisplayName (of contact selector value) and the second txt field will hold the last name. As you probably already know...the DisplayName value of contact selector displays as [LastName],[FirstName]. What I'm doing for now is to just try and get a successful parse so I'm setting the default value of the hidden txt field to be the value obtained using your highly complex and impressive concat statement.
I hope this makes sense and you or someone can help cuz the ability to get this working drives whether a form of ours gets put into production or not. Thank you in advance for any help.
In most companies DisplayName is capitalized already. So your expression should be much simplier. For example
LastName: substring-before(DisplayName," ") FirstName: substring-after(DisplayName," ")
Hi Alec,
Could you help me by maybe filling in the blanks for me....I'm a rookie at all of this just trying stuff as I go. Unfortunately not a lot of it makes sense to me:
so per your suggestion I should have the following?concat(translate(substring-before(DisplayName," "))) - which is to get the last name...and then a separate one:concat(translate(substring-before(DisplayName," "))) - to get the first name....but how would I go about putting them together.
I tried applying your response and the forumla checker kept erroring on the "LastName" and "FirstName" parts.
The LastName and FirstName are your hidden fields they are not part of the formula. And here are the expressions to set your hidden fields to the new values. You will need two separate actions for each of your field.
substring-before(DisplayName," ") - which is to get the last name...
substring-after(DisplayName," ") - to get the first name
Hi, I have a similar issue
Displayname is Lastname, Firstname (XX)
Need to parse out the email address - Firstname.Lastname@domain.com
Got most of it working from the posts here but now need to parse out firstname without the (XX) (note that XX is a two character country code)