cancel
Showing results for 
Search instead for 
Did you mean: 

Using Properties to find length of multiple values of the same keyword and then splitting keyword based on returned value?

Stephen_Dignam
Star Collaborator
Star Collaborator

Hello all, I am on OnBase 13 and attempting to clean up some legacy data. In our environment, for quite some time, the Name keyword has been used for both Last Name and Full Name.

I'm looking to attempt to rectify that and go backwards and correct the documents in our system this way. I'm guessing the len property in Core based Workflow is probably my best bet to accomplish this.

However, I'm not sure I grasp how to use it to show the length for multiple instances of the same exact keyword on a document.

I was planning on using the len function to determine the length of each instance of the Name keyword and then later on copying that to the Last Name field and leaving Name with the longer length.

Once the legacy items are cleared up, I plan on using Autofill Keyword Sets going forward.

I'm not very familiar with scripting at this point, but realize this would be very beneficial in determining a solution.

Thank you in advance for any help or suggestions,

Stephen

2 ACCEPTED ANSWERS

Eric_Beavers
Employee
Employee

Splitting Full Name into first and last name is usually strait forward. The biggest issue is determining if there are special characters or multiple names. If you know for a fact that all Full Names only follow the format of "FIRST LAST" then the following solves it...

The function of InStr() is useful for finding characters.

For example InStr("Stephen Dignam";" ") will result in 7 (the location of the space from the left starting with a count of 0)

Next, the function of Left() can be used to extract the First Name to that point. The combined functions would look like:

Left(%K<full name keyword here>;InSTR(%V<full name keyword here>;" "))

so

propFirsttName = Left("Stephen Dignam";InSTR("Stephen Dignam";" "))

returns

propFirstName = Stephen

After that we can get the Last Name in a few ways.

The Mid() function can be used with the previous InStr() trick or you can simply use a Replace() function.

Replace Example-

propLastName = Replace(%VPropFullName;%VPropFirstName+" ";"";true)

propLastName = Replace("Stephen Dignam";"Stephen"+" ";"";true)

results in

propLastName = "Dignam"

 

Mid Example (this one requires much more work)-

Mid(%VPropFullName;
InSTR(%VPropFullName;" ")+1;
LEN(%VPropFullName)-InSTR(%VPropFullName;" ")
)

 

---------------

Your biggest challenge will be for all the names that don't match the pattern of First Last. Here are some variances examples that I have encountered:

  • Reverse Format - Beavers, Eric
  • Middle name - Mark Eric Beavers
  • Prefix or Suffix - Mr. Mark Beavers Jr.
  • Containts InStr (space) Character - Eric Von Trapp
  • Latin Naming Convention (First second-First FathersLast MothersLast) - Enrique Carlos Arroyo Perez
  • Single Names(no last name) - Tushar

In each of these cases you would need to use InStr(), Count(), Replace() or IsMatch() to trap the pattern and then decide how to deal with the exception.

Here is a property expression that will count the number of words based on spaces (it uses the Replace function to remove anything that is not a Space character then counts only the spaces; you have to add one as it starts the count at 0)

LEN(Replace(%VpropFullName;"[^\s]";"";true))+1

 

I always liked Miguel Z's recommendation to focus on automating exceptions that occur 80%+ of the time, and then send the lesser exceptions to a lifecycle or queue for a person to review.

View answer in original post

Rob_Keberdle
Star Collaborator
Star Collaborator

You mention using an AutoFill to address new documents going forward.  If the existing documents already have the primary key assigned to them, you could use the Keyword Updater to replace the Name keyword(s) - potentially eliminating all exceptions.

View answer in original post

9 REPLIES 9

Steve_Warner
Star Contributor
Star Contributor
You could check the NAME keyword for a pattern of characters space characters (Specifically to identify the space), if this pattern is not found then it's likely a last name value and can be copied in full to a property and then to the LAST NAME keyword and deleted from the NAME keyword. If the pattern is found then it's a full name and you could copy the rightmost portion of the value to a Property and then to the LAST NAME keyword.

Stephen_Dignam
Star Collaborator
Star Collaborator
Thank you for the advice. Is there any specific property function that would be best suited to accomplishing this particular task?

Eric_Beavers
Employee
Employee

Splitting Full Name into first and last name is usually strait forward. The biggest issue is determining if there are special characters or multiple names. If you know for a fact that all Full Names only follow the format of "FIRST LAST" then the following solves it...

The function of InStr() is useful for finding characters.

For example InStr("Stephen Dignam";" ") will result in 7 (the location of the space from the left starting with a count of 0)

Next, the function of Left() can be used to extract the First Name to that point. The combined functions would look like:

Left(%K<full name keyword here>;InSTR(%V<full name keyword here>;" "))

so

propFirsttName = Left("Stephen Dignam";InSTR("Stephen Dignam";" "))

returns

propFirstName = Stephen

After that we can get the Last Name in a few ways.

The Mid() function can be used with the previous InStr() trick or you can simply use a Replace() function.

Replace Example-

propLastName = Replace(%VPropFullName;%VPropFirstName+" ";"";true)

propLastName = Replace("Stephen Dignam";"Stephen"+" ";"";true)

results in

propLastName = "Dignam"

 

Mid Example (this one requires much more work)-

Mid(%VPropFullName;
InSTR(%VPropFullName;" ")+1;
LEN(%VPropFullName)-InSTR(%VPropFullName;" ")
)

 

---------------

Your biggest challenge will be for all the names that don't match the pattern of First Last. Here are some variances examples that I have encountered:

  • Reverse Format - Beavers, Eric
  • Middle name - Mark Eric Beavers
  • Prefix or Suffix - Mr. Mark Beavers Jr.
  • Containts InStr (space) Character - Eric Von Trapp
  • Latin Naming Convention (First second-First FathersLast MothersLast) - Enrique Carlos Arroyo Perez
  • Single Names(no last name) - Tushar

In each of these cases you would need to use InStr(), Count(), Replace() or IsMatch() to trap the pattern and then decide how to deal with the exception.

Here is a property expression that will count the number of words based on spaces (it uses the Replace function to remove anything that is not a Space character then counts only the spaces; you have to add one as it starts the count at 0)

LEN(Replace(%VpropFullName;"[^\s]";"";true))+1

 

I always liked Miguel Z's recommendation to focus on automating exceptions that occur 80%+ of the time, and then send the lesser exceptions to a lifecycle or queue for a person to review.

Thank you very much, this should be very helpful!
Getting started

Find what you came for

We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.