Focal Point
Concatenation question

This topic can be found at:
https://forums.informationbuilders.com/eve/forums/a/tpc/f/7971057331/m/8721041942

September 28, 2007, 04:47 PM
Jaywill
Concatenation question
I have a PERSON synonym with three fields that I'd like to concatenate, remove extra spaces, and then chop off all but the first 30 characters.

The fields are:
LAST_NAME A57
FIRST_NAME A30
MIDDLE_NAME A30

I'd like it in this format:
LAST_NAME, FIRST_NAME MIDDLE_NAME

I tried coding TRIMMED_FULL_NAME as follows, but it only gave me "LAST_NAME,":

FULL_NAME/A120=TRIM('B',PERSON.PERSON.LAST_NAME, 57, ' ', 1, 'A57')||', '| TRIM('B', PERSON.PERSON.FIRST_NAME, 30, ' ', 1, 'A30') | ' ' | TRIM('B', PERSON.PERSON.MIDDLE_NAME, 30, ' ', 1, 'A30');

TRIMMED_FULL_NAME/A30=SUBSTR(120, FULL_NAME, 1, 30, 30, 'A30');


Any suggestions?


WF 8.0.08 ... Windows Server 2008
September 28, 2007, 05:06 PM
JimRice
Try this:

FULL_NAME/A120 = LAST_NAME || (', ' | FIRST_NAME) || (' ' | MIDDLE_NAME);
TRIMMED_FULL_NAME/A30 = SUBSTR(120, FULL_NAME, 1, 30, 30, 'A30');

Jim


WF DevStu 5.2.6/WF Srv 5.2.4/Win NT 5.2
September 28, 2007, 05:43 PM
Jaywill
Thank you! That works perfectly.


WF 8.0.08 ... Windows Server 2008
October 01, 2007, 12:27 AM
Piipster
I'd make one change to Jim's:
FULL_NAME/A120 = LAST_NAME || ((', ' | FIRST_NAME) || (' ' | MIDDLE_NAME)));
TRIMMED_FULL_NAME/A30 = SUBSTR(120, FULL_NAME, 1, 30, 30, 'A30');


This way you can be sure this will work correctly with all output formats.


ttfn, kp


Access to most releases from R52x, on multiple platforms.
October 01, 2007, 11:25 AM
ihf
Plipster, JimRICE:

Quick and easy solution. Nice job. P.S. JIMRICE not only did you play baseball well you code equally as well.
ira unix 5.3.6