I have a field where the first name and last name are in this format:
Smith, Adam
The following code correctly breaks down the name into seperate first and last name fields in my new table, but I encounter a substr error when the process comes across data in the field that is missing the First Name.
(Smith, ) without the quotes.
Can someone please help with getting the procedure to ignore if there is no first name after the comma-space?
Thanks,
Steve
Smith, Adam
The following code correctly breaks down the name into seperate first and last name fields in my new table, but I encounter a substr error when the process comes across data in the field that is missing the First Name.
(Smith, ) without the quotes.
Can someone please help with getting the procedure to ignore if there is no first name after the comma-space?
Code:
var
str1 string
strc, strsz smallint
endVar
;// populates the Firstname Lastname fields of ddscumul_WMS
str1 = rempsTC."FSNANAME"
strsz = size (str1) ; gets the string size of FSNANAME
strc = str1.search(",") ; searches the string for the first instance of the comma
strc = strc - 1
lname = str1.substr(1,strc)
ddcTC."LAST NAME" = lname
strc = strc + 3
fname = str1.substr(strc,strsz)
ddcTC."FIRST NAME" = fname
Thanks,
Steve