Focal Point
LCWORD hoses Concatenation

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

July 26, 2007, 10:31 AM
John_Edwards
LCWORD hoses Concatenation
I have reports running where I have to combine a first and last name after converting case, and LCWORD seems completely determined to not allow me to remove trailing blanks from the first name. The basic code:

Counselor_Name/A60=LCWORD(15, FIRST_NAME, 'A15') || ' ' | LCWORD(24, LAST_NAME, 'A24');

Looks very pretty in html, as html removes the extra spaces as a courtesy (or curse depending on your needs). In pdf the blanks on the end of the first name magically return.

I've twisted this about two-dozen ways, via ARGLEN and SUBSTR and the like, breaking it into pieces, but to no avail. If someone has made LCWORD and Strong Concatenation work together I would very much appreciate a reply.

Please -- I am not a rookie, and I have worked this. Reply if you have proven, in-production code only.


Remarkable that this bug has not been reported and fixed after 25 years of FOCUS.



July 26, 2007, 10:49 AM
Tony A
John,

We are aware that you are not a rookie, but it would be nice to know what platform and release you are using so that we can check on the same before we reply Smiler. Please update your signature?

T



In FOCUS
since 1986
WebFOCUS Server 8.2.01M, thru 8.2.07 on Windows Svr 2008 R2  
WebFOCUS App Studio 8.2.06 standalone on Windows 10 
July 26, 2007, 10:52 AM
John_Edwards
7.6 on Wintel. I will update my profile now, although each of my customers is using something different (sigh).



July 26, 2007, 11:01 AM
hammo1j
LCWORD(15, FIRST_NAME, 'A15') || ( ' ' | LCWORD(24, LAST_NAME, 'A24')) ;

Remember that wf evaluates left to right so it
does (without the brackets)

res1 = Hard Concat first name and blank
Soft Concat res1 and last name.

Bracketting changes the order

Or better still try Tony's solution...

This message has been edited. Last edited by: hammo1j,



Server: WF 7.6.2 ( BID/Rcaster) Platform: W2003Server/IIS6/Tomcat/SQL Server repository Adapters: SQL Server 2000/Oracle 9.2
Desktop: Dev Studio 765/XP/Office 2003 Applications: IFS/Jobscope/Maximo
July 26, 2007, 11:01 AM
Tony A
Such are the trials of life Wink

As for a solution try the concatenation first and then perform the LCWORD topped off with the SQUEEZ function -
Counselor_Name/A60=SQUEEZ(40, LCWORD(40, (FIRST_NAME || (' ' | LAST_NAME)), 'A40'), 'A40');

Or better still try John's solution ...

T

This message has been edited. Last edited by: Tony A,



In FOCUS
since 1986
WebFOCUS Server 8.2.01M, thru 8.2.07 on Windows Svr 2008 R2  
WebFOCUS App Studio 8.2.06 standalone on Windows 10 
July 26, 2007, 11:13 AM
John_Edwards
quote:
Originally posted by hammo1j:
LCWORD(15, FIRST_NAME, 'A15') || ( ' ' | LCWORD(24, LAST_NAME, 'A24')) ;

Remember that wf evaluates left to right so it
does (without the brackets)

res1 = Hard Concat first name and blank
Soft Concat res1 and last name.

Bracketting changes the order


Although this is completely counter-intuitive to me (the failing concat does not change its ordering), it works perfectly. Thanks!



July 26, 2007, 12:09 PM
Glenda
As they say, there's more than one way to skin a cat.

Here's mine.

NAME/A50 = LCWORD(50, SQUEEZ(50, FNAME|LNAME, 'A50'), 'A50');


Glenda

In FOCUS Since 1990
Production 8.2 Windows
July 26, 2007, 12:17 PM
Leah
John, I usually do the LCWORD after the concatentations on the whold field and it seems to work fine. Of course on names it can be tricky if they are MacGuyver for example do you allow for that?


Leah
July 26, 2007, 12:29 PM
Glenda
Good thought Leah. That really does make one have to step back and rethink out the solution.

I really do love the FOCAL POINT "Think Tank".


Glenda

In FOCUS Since 1990
Production 8.2 Windows
July 26, 2007, 12:34 PM
John_Edwards
I've instructed the customer to fire all Scotsmen.

This message has been edited. Last edited by: John_Edwards,



July 26, 2007, 12:48 PM
Tony A
It's not only the Scots that have apostrophes in their surnames Wink



In FOCUS
since 1986
WebFOCUS Server 8.2.01M, thru 8.2.07 on Windows Svr 2008 R2  
WebFOCUS App Studio 8.2.06 standalone on Windows 10 
July 26, 2007, 09:10 PM
Piipster
Remember that strong concatenation (||) doesn't remove the blanks. It just moves them. The brackets make a single unit out of the last two elements so that the blanks at the end of the first name can be moved after them.

If you don't put the brackets in it will move them after the space you are inserting between the first and last names. It's not failing. It's doing exactly what you asked it to.


ttfn, kp


Access to most releases from R52x, on multiple platforms.
July 27, 2007, 08:23 AM
John_Edwards
"Remember that strong concatenation (||) doesn't remove the blanks. It just moves them."

It is my greatest hope and that you just made this up to be humorous.



July 29, 2007, 09:13 PM
Piipster
I was an Information Builders Instructor in FOCUS and WebFOCUS for many years. The biggest misconception about strong concatenation is that it strips out blanks. Consider the following:

A || B
If A has trailing blanks they are moved to the end of B.

A || B | C
The expression is evaluated from left to right. If A has trailing blanks they are still moved to after B, the object on the right side of the strong concatenation symbol.

A || (B | C)
The object 'B | C' is evaluated first because of the brackets. It is now the object that is on the right side of the strong concatenation symbol so the trailing blanks from A are moved all the way to the end.

It was much more evident in the fixed fonts of the mainframe than it is with html output. Test it out with a COURIER font in PDF and it will become more clear.


ttfn, kp


Access to most releases from R52x, on multiple platforms.
July 30, 2007, 08:56 AM
jgelona
John_Edwards, sorry but Piipster is exactly correct.


In FOCUS since 1985. Prod WF 8.0.08 (z90/Suse Linux) DB (Oracle 11g), Self Serv, Report Caster, WebServer Intel/Linux.
July 30, 2007, 09:24 AM
John_Edwards
This may be because the 102 course uses the language "remove the trailing blanks" in several locations.

But in the help files in Dev Studio it does indeed say that they are moved to the end of the string. See? You learn something new every day.

J.