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     Dividing a long string into several fields

Read-Only Read-Only Topic
Go
Search
Notify
Tools
Dividing a long string into several fields
 Login/Join
 
<Stahl>
posted
Dear all,
I want to divide a long string into several fields according to a given delimiter-string.

e.g.:
string: abc?/xyz12345?/456z?/die
delimiter string: ?/
The new fields should be like this:
f1 = xyz12345
f2 = 456z
f3 = die
(The first part "abc" can be ignored.)
What I don't know in advance is, how many parts the original string has. It can be longer or shorter than the example included her.
So I don't really know, how many new fields to define.

Any hints are highly appretiated!

Thanks a lot!
stahl
 
Report This Post
Expert
posted Hide Post
sure
you're going to use the POSIT function and the SUBSTR function.
(see the Using Functions Manual. Do you have it?)
POSIT will locate the delimeter, whatever delimeter you specifcy.
SUBSTR will extract a substring from some starting position (last POSIT of the delimeter + 1) to some ending position( current POSIT of the delimeter -1).
You'll loop thru your string until POSIT is 0, meaning can't find any more.
Are you ok from here?
 
Posts: 3811 | Location: Manhattan | Registered: October 28, 2003Report This Post
Guru
posted Hide Post
If you are manipulating the string as Dialog Manager variables the looping will be fine to tell you when to stop.

If you need the values in DEFINE fields, you are going to have to make some assumptions about the longest possible substring and the most number of occurrences of the substrings, and DEFINE enough fields to handle them all.
 
Posts: 346 | Location: Melbourne Australia | Registered: April 15, 2003Report This Post
Silver Member
posted Hide Post
quote:
Originally posted by susannah:
sure
you're going to use the POSIT function and the SUBSTR function.
(see the Using Functions Manual. Do you have it?)
POSIT will locate the delimeter, whatever delimeter you specifcy.
SUBSTR will extract a substring from some starting position (last POSIT of the delimeter + 1) to some ending position( current POSIT of the delimeter -1).
You'll loop thru your string until POSIT is 0, meaning can't find any more.
Are you ok from here?


Can POSIT be done with the delimiter being a space?


------------------------------------------
last version used: v7.1; truly miss the wonderful things I did with WebFOCUS, HTML, & JavaScript.
 
Posts: 36 | Location: Rolling Meadows, IL | Registered: September 05, 2007Report This Post
Virtuoso
posted Hide Post
yes - you just have to be careful of spaces in the string like the space between first and last name. it may not be a delimiter, but would be counted as one anyway


Regards,

Darin



In FOCUS since 1991
WF Server: 7.7.04 on Linux and Z/OS, ReportCaster, Self-Service, MRE, Java, Flex
Data: DB2/UDB, Adabas, SQL Server Output: HTML,PDF,EXL2K/07, PS, AHTML, Flex
WF Client: 77 on Linux w/Tomcat
 
Posts: 2298 | Location: Salt Lake City, Utah | Registered: February 02, 2007Report This Post
Gold member
posted Hide Post
This is usually easy to accomplish using the GETTOK subroutine.



Windows: WF 7.6.2: SQL Server 2008 R2
 
Posts: 86 | Location: Chicago | Registered: August 03, 2007Report 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     Dividing a long string into several fields

Copyright © 1996-2020 Information Builders