Focal Point Banner
Community Center Education Summit Technical Support User Groups
Let's Get Social!

Facebook Twitter LinkedIn YouTube
Go
New
Search
Notify
Tools
Reply
  
Concatenate syntax
 Login/Join
 
Member
posted
What is a difference in using | vs || to concatenate two columns?


WebFOCUS 7.7, iWay Data Migrator, Windows
Excel, PDF, HTML, XML
 
Posts: 19 | Registered: March 19, 2012Reply With QuoteReport This Post
Member
posted Hide Post
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
 
Posts: 19 | Registered: March 19, 2012Reply With QuoteReport This Post
Expert
posted Hide Post
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.04OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Know The Code

 
Posts: 6015 | Location: Land of the Darug people, Terra Australis Incognita | Registered: October 31, 2006Reply With QuoteReport This Post
  Powered by Social Strata  
 


Copyright © 1996-2018 Information Builders, leaders in enterprise business intelligence.