Focal Point Banner


As of December 1, 2020, Focal Point is retired and repurposed as a reference repository. We value the wealth of knowledge that's been shared here over the years. You'll continue to have access to this treasure trove of knowledge, for search purposes only.

Join the TIBCO Community
TIBCO Community is a collaborative space for users to share knowledge and support one another in making the best use of TIBCO products and services. There are several TIBCO WebFOCUS resources in the community.

  • From the Home page, select Predict: WebFOCUS to view articles, questions, and trending articles.
  • Select Products from the top navigation bar, scroll, and then select the TIBCO WebFOCUS product page to view product overview, articles, and discussions.
  • Request access to the private WebFOCUS User Group (login required) to network with fellow members.

Former myibi community members should have received an email on 8/3/22 to activate their user accounts to join the community. Check your Spam folder for the email. Please get in touch with us at community@tibco.com for further assistance. Reference the community FAQ to learn more about the community.


Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [CLOSED] Concatenate defines into a comma separated value.

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[CLOSED] Concatenate defines into a comma separated value.
 Login/Join
 
Platinum Member
posted
Hi,

I have 10 define fields which is of A20 format.
Now i want to create a field which concatenate all 10 define fields.

The issue i have is when concatenating using the operand ||','|| i get continuous comma when a define field is empty.
I tried using TRIM with LEADING , TRAILING and BOTH options,but how can i remove the commas in between.

 TRIM_(BOTH, ',', DEF1 || ','|| DEF2 ||','|| DEF3 ||','|| DEF4 ||','|| DEF5 ||','|| DEF6 ||','|| DEF7 ||','|| DEF8 ||','|| DEF9 || ','||DEF11 ) 


Any suggestions.

This message has been edited. Last edited by: FP Mod Chuck,


WF8206,Windows 7,8,10
HTM,PDF,EXCEL
 
Posts: 229 | Location: MI | Registered: September 13, 2017Report This Post
Virtuoso
posted Hide Post
Can you show us what you're seeing and what you expect? I'm not sure I understand what's happening when a define is empty.


WebFOCUS 8206, Unix, Windows
 
Posts: 1853 | Location: New York City | Registered: December 30, 2015Report This Post
Platinum Member
posted Hide Post
When i have DEF1, DEF2 and DEF6 as empty i get the output like.

  
,,DEF3,DEF4,DEF5,,,DEF7,DEF8,DEF9,DEF10


If i use TRIM_(LEADING, ',', DEF1 || ','|| DEF2 ||','|| DEF3 ||','|| DEF4 ||','|| DEF5 ||','|| DEF6 ||','|| DEF7 ||','|| DEF8 ||','|| DEF9 || ','||DEF11 ) ,i can get rid of the first two commas.

But when i have commas between define outputs,TRIM won't help.


WF8206,Windows 7,8,10
HTM,PDF,EXCEL
 
Posts: 229 | Location: MI | Registered: September 13, 2017Report This Post
Virtuoso
posted Hide Post
Take a look at REPLACE function. That might be a better one to use.
https://webfocusinfocenter.inf...r/source/replace.htm


WebFOCUS 8206, Unix, Windows
 
Posts: 1853 | Location: New York City | Registered: December 30, 2015Report This Post
Platinum Member
posted Hide Post
I am working in 8105 currently(for this issue) and it seems like 8105 don't have REPLACE function.

Also it will replace all the commas i think.


WF8206,Windows 7,8,10
HTM,PDF,EXCEL
 
Posts: 229 | Location: MI | Registered: September 13, 2017Report This Post
Expert
posted Hide Post
Check out the documentation on functions.

Look at STRREP for example.

The other option you have is to create an intermediate define field for each testing for blank, and either leaving as blank or adding the comma, then combine.


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!

 
Posts: 6347 | Location: 33°49'23.0"S, 151°11'41.0"E | Registered: October 31, 2006Report This Post
Platinum Member
posted Hide Post
Okay @Waz.
I did use STRREP ,but it work similar to REPLACE.
I am thinking of moving forward with the other option you mentioned.


WF8206,Windows 7,8,10
HTM,PDF,EXCEL
 
Posts: 229 | Location: MI | Registered: September 13, 2017Report This Post
Expert
posted Hide Post
Yes, its probably the more robust option.


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!

 
Posts: 6347 | Location: 33°49'23.0"S, 151°11'41.0"E | Registered: October 31, 2006Report This Post
Master
posted Hide Post
quote:
The other option you have is to create an intermediate define field for each testing for blank, and either leaving as blank or adding the comma, then combine.


Agreed. And then use the TRIM_ function to remove the trailing comma. Something like this:
 

DEFINE FILE master
DEF1/A4 = IF Field1 EQ '' THEN '' ELSE Field1 || ',';
DEF2/A4 = IF Field2 EQ '' THEN '' ELSE Field2 || ',';
DEF3/A4 = IF Field3 EQ '' THEN '' ELSE Field3 || ',';
DEF4/A4 = IF Field4 EQ '' THEN '' ELSE Field4 || ',';
DEF5/A4 = IF Field5 EQ '' THEN '' ELSE Field5 || ',';
DEF6/A4 = IF Field6 EQ '' THEN '' ELSE Field6 || ',';
DEF7/A4 = IF Field7 EQ '' THEN '' ELSE Field7 || ',';
DEF8/A4 = IF Field8 EQ '' THEN '' ELSE Field8 || ',';
DEF9/A4 = IF Field9 EQ '' THEN '' ELSE Field9 || ',';
CONCAT/50V = TRIM_(TRAILING, ',', DEF1||DEF2||DEF3||DEF4||DEF5||DEF6||DEF7||DEF8||DEF9);
END
 


Hallway

 
Prod: 8202M1
Test: 8202M4
Repository:
 
OS:
 
Outputs:
 
 
 
 
 
Posts: 608 | Location: Salt Lake City, UT, USA | Registered: November 18, 2015Report This Post
  Powered by Social Strata  

Read-Only Read-Only Topic

Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [CLOSED] Concatenate defines into a comma separated value.

Copyright © 1996-2020 Information Builders