Skip to main content

Hi,

 

I have a form which requires 2 seperate text boxes to be autopopulated by the Surname and Firstname.

I've played around with the Displayname value which is returned to get the current user, but how can I split the string so that Surname goes in one textbox and firstname goes in the other box?

 

I had a look at expressions, hoping I could do something to capture everything upto the comma (surname)in one box and everything after the comma for the firstname. I have tried every expression but couldn't get any to work.

 

Can anyone do a step by step to do this for me, i did try.

 

Thanks

get fn
Mid( Display Name, 0, Find( Display Name, spacehere ) )


get sn
Mid( Display Name, Find( Display Name, spacehere ), Length( Display Name ) )

 

Hope this helps


Sorry to be new, but where do i enter that?


Sorry, for the first name click on th firstname control and then on the right hand side you will see the properties of that control. There should be an expression property. When you click that it will give you a window to create the expression.  near the bottom of that window there s a operators tab where you can drag and drop all the built in methods used here. You cannot just type this in. You have to drag and drop each built in method and build the expression.

 

I have included screenshts if it helps:

16661iB80F8C1A50E1A2DD.png17054i722C50E05F757621.png


Thanks for that, i created the expression for fn. Only thing is that it leaves a trailing comma i.e. bloggs,

 

Can you say how to remove the comma?


Not sure I understand, Are you saying the name you are using contains a comma. I think you placed a comma isntead of a empty space bar.


Hi,

 

See below pic of the expressions, they are exactly the same.

 

If i use no expression, the return value of Displayname is Bloggs, Joe

 

So when i'm using the Lastname expression  its bringing out this: Bloggs,

 

The firstname expression works fine and brings back: Joe

 

 16501iE859B7FFF20A5493.jpg


13290iB6775FA65772CE9A.jpg

I see that you store the display name with first name and surname reversed. In this case what you can do is use the "Replace" method and put the whole expression in that. And then just put comma symbol in the string to be replaced.


Got this working using two expressions, one to remove the comma in the first place, then i call that expression result into another expression to do the MID command, thanks for your help.

 

Wasn't sure how to use the Replace Method you mentioned, but if you could show me how, it might be easier than my workaround...


As you can see the replace method takes three parameters if you hover over the method.

 

Text : this would be your current expression.

Find:  would be a comma

Replace: would be a empty string

 

Hope ths helps

 

 

 

 

 

 


Reply