Focal Point
Concatenate syntax

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

March 28, 2012, 04:56 PM
AnnaR
Concatenate syntax
What is a difference in using | vs || to concatenate two columns?


WebFOCUS 7.7, iWay Data Migrator, Windows
Excel, PDF, HTML, XML
March 28, 2012, 05:08 PM
AnnaR
Found the difference:
|| trims the column while | does not: for instance:
var1 = 'cat '
var2 = 'dog'
var1 | var2 => 'cat dog'
var1 || var2 => 'catdog'

Please let me know if there are other differences.


WebFOCUS 7.7, iWay Data Migrator, Windows
Excel, PDF, HTML, XML
March 28, 2012, 05:13 PM
Waz
A single | is a soft concatenate, a || is a hard concatenate.

e.g.
Text1 = 'text     '
Text2 = ' more    '

Text3 = Text1 | Text2
Text3 will contain 'text      more    '

Text4 = Text1 || Text2
Text4 will contain 'text more         '


With a hard concatenate, the trailing spaces are shifted to the end of the expression. If you start using parentheses, you can control where the hard and soft concats happen.

e.g.
Text1 = 'text     '
Text2 = 'more     '

Text3 = Text1 || Text2
Text3 will contain 'textmore          '

Text4 = Text1 || (' ' | Text2)
Text4 will contain 'text more          '



Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.07OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!