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]Splitting a column values into two columns.

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[Closed]Splitting a column values into two columns.
 Login/Join
 
Platinum Member
posted
Hi I have the below sample code with CAR file where i am splitting a column values into two separate columns.

  
TABLE FILE CAR
BY COUNTRY
BY MODEL
WHERE COUNTRY EQ 'W GERMANY'
ON TABLE HOLD AS EXT1
END
-*-EXIT

DEFINE FILE EXT1
SNO/I2 = IF LAST MODEL NE MODEL THEN SNO+1 ELSE SNO;
SNO_IMOD/I2 = IMOD(SNO, 2, SNO_IMOD);
END
TABLE FILE EXT1
BY COUNTRY
BY SNO
BY SNO_IMOD
BY MODEL
ON TABLE HOLD AS EXT2
END
-*-EXIT

DEFINE FILE EXT2
MODEL_1/A100 = IF SNO_IMOD EQ 1 THEN MODEL ELSE '';
MODEL_2/A100 = IF SNO_IMOD EQ 0 THEN MODEL ELSE '';
END
TABLE FILE EXT2
PRINT
MODEL_1
MODEL_2
END
-EXIT



The output i get is shown below.
Capture

I am trying to get the output without the empty string in the rows.I tried COMPUTE and it didn't work for me.
I think i am missing some basic simple logic there,and i am not able to get it right.

Suggestions please.

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


WF8206,Windows 7,8,10
HTM,PDF,EXCEL
 
Posts: 229 | Location: MI | Registered: September 13, 2017Report This Post
Guru
posted Hide Post
Any reason why you're not using SUBSTR or other character functions to split the string?
 COMPUTE STR1/A10 = EDIT(MODEL,'999999999$$$$$$$$');
COMPUTE STR2/A10 = EDIT(MODEL,'$$$$$$$$9999999999'); 


-********************
Sandbox: 8206.10
Dev: 8201M
Prod:8009
-********************
 
Posts: 289 | Location: Houston,TX | Registered: June 11, 2004Report This Post
Platinum Member
posted Hide Post
quote:
not using SUBSTR or other character functions to split the string?


I am not trying to split a particular string.I am string to store values from a column into two separate columns.


WF8206,Windows 7,8,10
HTM,PDF,EXCEL
 
Posts: 229 | Location: MI | Registered: September 13, 2017Report This Post
Platinum Member
posted Hide Post
Finally got it working.The solution i have is to store the fields into two separate hold files and then join which will give the output the way i need.


WF8206,Windows 7,8,10
HTM,PDF,EXCEL
 
Posts: 229 | Location: MI | Registered: September 13, 2017Report This Post
Virtuoso
posted Hide Post
Maybe a bit simpler:
  
TABLE FILE CAR
LIST MODEL
ON TABLE HOLD
END
-RUN
DEFINE FILE HOLD
L/I5=LIST - 1;
C/I1=IMOD(L,2,'I1');
R/I5=L / 2;
END
TABLE FILE HOLD
SUM MODEL
BY R NOPRINT ACROSS C NOPRINT
END



Daniel
In Focus since 1982
wf 8.202M/Win10/IIS/SSA - WrapApp Front End for WF

 
Posts: 1980 | Location: Tel Aviv, Israel | Registered: March 23, 2006Report 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]Splitting a column values into two columns.

Copyright © 1996-2020 Information Builders