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] separating a string of data by position and assigning to the same field

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[CLOSED] separating a string of data by position and assigning to the same field
 Login/Join
 
Gold member
posted
I have a field in a file with a format of A36V. the first 4 characters is an ID. The remaining characters are assigned TAG. A TAG is 4 characters long. So after the first 4 characters, every 4 characters there after represents a TAG. I want to assign the tags to a new field called TAG. So if the string has 16 characters then there is an ID with 3 TAGS, and these tags should be in three separate rows in the TAG column. My first thought was a define but that will not work. Does anyone have any suggestions on how to separate this string of data.

This message has been edited. Last edited by: <Kathryn Henning>,


WebFOCUS 7.6.2, MS Windows Server/______, Excel, PDF, HTML
 
Posts: 91 | Registered: May 15, 2008Report This Post
Platinum Member
posted Hide Post
Since you mentioned ID will have 4 character length and TAG also 4 character length.

Read you string to a variable and divide the length by 4 . According to your example with 16 characters 16/4 = 4 so try to loop based on the output (in this case 4 times and use the below function
SUBSTR(length, source_string, start, end, sublength, output)

In that using a counter try to increment the start and end positions each time in the loop.


WebFOCUS - ver8201
[ReportingServers: Windows 64bit;
Client: tomcat and IIS on windows 2012
AppStudio

 
Posts: 104 | Location: Indianapolis | Registered: November 08, 2007Report This Post
Expert
posted Hide Post
I would use an alternate master, one that has an OCCURS clause. Here's an example, though I can't manage to get it to work with an AnV field.

testdata1.ftm:
ENGLAND   AAAA12349876ABCDWXYZ
ENGLAND   ABCDOPQR6789ASDFZXCVTHATFLEA9812
FRANCE    CCCC987656781234QWRT
ITALY     DEFG98341278

testdata1.mas:
FILE=TESTDATA1, SUFFIX=FIX, $
SEGNAME=TESTDATA1
  FIELDNAME=COUNTRY     , ALIAS=COUNTRY     , USAGE=A10, ACTUAL=A10, $
  FIELDNAME=COUNTRY_DATA, ALIAS=COUNTRY_DATA, USAGE=A36, ACTUAL=A36, $

testdata1_occ.mas:
FILE=TESTDATA1_OCC, SUFFIX=FIX, $
SEGNAME=TESTDATA1
  FIELDNAME=COUNTRY     , ALIAS=COUNTRY     , USAGE=A10, ACTUAL=A10, $
  FIELDNAME=ID          , ALIAS=ID          , USAGE=A04, ACTUAL=A04, $
  FIELDNAME=COUNTRY_DATA, ALIAS=COUNTRY_DATA, USAGE=A32, ACTUAL=A32, $
SEGNAME=TAGS, PARENT=TESTDATA1, POSITION=COUNTRY_DATA, OCCURS=VARIABLE, $
  FIELDNAME=TAG         , ALIAS=TAG         , USAGE=A04, ACTUAL=A04, $

testdata1.fex:
SET BYDISPLAY=ON
SET PAGE=NOLEAD
-RUN

FILEDEF TESTDATA1 DISK test/testdata1.ftm
-RUN

TABLE FILE TESTDATA1
PRINT
COUNTRY_DATA
BY COUNTRY
END
-RUN

FILEDEF TESTDATA1_OCC DISK test/testdata1.ftm
-RUN

TABLE FILE TESTDATA1_OCC
PRINT
TAG
BY COUNTRY
BY ID
END
-RUN


Francis


Give me code, or give me retirement. In FOCUS since 1991

Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
 
Posts: 10577 | Location: Toronto, Ontario, Canada | Registered: April 27, 2005Report This Post
Virtuoso
posted Hide Post
Kitten,

Example. Your field is CATSLOVENICEGREY. Is this what you want to see:
  
ID    TAG
CATS  LOVE
      NICE
      GREY

But then a question: are you going to want to display other fields?


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
Gold member
posted Hide Post
Yes Danny that is what I'd like to see and yes I want to display other fields.


WebFOCUS 7.6.2, MS Windows Server/______, Excel, PDF, HTML
 
Posts: 91 | Registered: May 15, 2008Report This Post
Expert
posted Hide Post
Try my suggestion.


Francis


Give me code, or give me retirement. In FOCUS since 1991

Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
 
Posts: 10577 | Location: Toronto, Ontario, Canada | Registered: April 27, 2005Report This Post
Gold member
posted Hide Post
Thanks Francis, I haven't started yet, but I'll let you know how it goes.


WebFOCUS 7.6.2, MS Windows Server/______, Excel, PDF, HTML
 
Posts: 91 | Registered: May 15, 2008Report This Post
Master
posted Hide Post
Francis, as always, is dead on.

OCCURS is the way to go.


WebFOCUS 7.7.05 Windows, Linux, DB2, IBM Lotus Notes, Firebird, Lotus Symphony/OpenOffice. Outputs PDF, Excel 2007 (for OpenOffice integration), WP
 
Posts: 674 | Location: Guelph, Ontario, Canada ... In Focus since 1985 | Registered: September 28, 2010Report 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] separating a string of data by position and assigning to the same field

Copyright © 1996-2020 Information Builders