Tom,
Here is some code that I have on a full name field that tries to properly switch person's name to last name first.
Jeff Ryder to Ryder Jeff
Jeff A Ryder to Ryder Jeff A
Jeff A Ryder III to Ryder III Jeff A
Jeff Ryder JR to Ryder JR Jeff
Jeff de Ryder to de Ryder Jeff
Code:
dim vStr as c
dim vNum as n
vStr=topparent:name.text
vNum=w_count(vStr)
'parse name to try to create sort key
select
case vNum = 2
topparent:sortkey.value=word(vStr,2) + " " + word(vStr,1)
case vNum = 3
if len(word(vStr,2)) = 1 then
topparent:sortkey.value=word(vStr,3) + " " + word(vStr,1," ",2)
else
topparent:sortkey.value=word(vStr,2," ",2) + " " + word(vStr,1)
end if
case vNum = 4
topparent:sortkey.value=word(vStr,3," ",2) + " " + word(vStr,1," ",2)
case else
topparent:sortkey.value=vStr
end select
Bookmarks