ParseName BuiltIn Function

ATTENTION: This forum is no longer active. Please navigate to our new support site at https://support.starfishetl.com/
Viewing 2 posts (of 2 total)
srijanapokharel
User - Author
Post count: 27
#1

Hi I am trying to split the first/middle/last names from the following string:

A B C; D E F And here is the code that I have written

Function ScriptedField
Dim MergedName,FullName,Contact1,Contact2,Array_SplittedNames, Contact1_FirstName,Contact1_MiddleName,Contact1_LastName,Contact2_FirstName,Contact2_MiddleName,Contact2_LastName, HouseholdName

MergedName=RemoveIllegalXMLCharacters("@@ORG:ContactNames@@") 'Assigning ContactNames Field to Variable and Removing the Illegal Characters
MergedName=Replace(MergedName, chr(013),"") 'Removing the Character Line Feed
MergedName=Replace(MergedName, chr(010), "")

Set re = New RegExp
re.Pattern = "([;])"
re.IgnoreCase = true

If re.Test(MergedName) Then ' If the ContactNames field contains 2 names
'Spliting the Names into two seperate Variables
Array_SplittedNames=Split(MergedName,";")
Contact1=Array_SplittedNames(0)
Contact2=Array_SplittedNames(1)

'Parsing Out the FirstName, MiddleName & LastName
Contact1_FirstName=ParseName(Contact1,"First")
Contact1_MiddleName=ParseName(Contact1,"Middle")
Contact1_LastName=ParseName(Contact1,"Last")

Contact2_FirstName=ParseName(Contact2,"First")
Contact2_MiddleName=ParseName(Contact2,"Middle")
Contact2_LastName=ParseName(Contact2,"Last")

ScriptedField=Contact1_Firstname

Else
ScriptedField=Parse("@@ORG:ContactNames@@","First")

End If
End Function

It doesn't show me anything in the preview. Can you please help me figure out when I am wrong? Thanks,
Srijana

Comments (2)

Aron Hoekstra's picture Aron Hoekstra
Administrator
Post count: 2
#2

Nice little function you have here.. On the Preview tab, note if something isn't working quite right you can click on "Log" and see if there are any errors.. Looks like on your line #31, you have:

ScriptedField=Parse("@@ORG:ContactNames@@","First")
but it should be:

ScriptedField=ParseName("@@ORG:ContactNames@@","First")

Log in to post comments
srijanapokharel's picture srijanapokharel
User - Author
Post count: 27
#3

Oops! My Bad.

Thanks for your help.

Log in to post comments
Viewing 2 posts (of 2 total)

Forum Login

Login or sign up for our forums to connect to the user community.

Reply

You must log in to post.

Not a Member? Register.