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

Facebook Twitter LinkedIn YouTube
Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [CLOSED] Rookie Web Focus User question
Go
New
Search
Notify
Tools
Reply
  
[CLOSED] Rookie Web Focus User question
 Login/Join
 
Member
posted
I'm new to web focus so my quesiton might be rather basic. I'm trying to figure out what code/funtion to use to break out a value in a field. I'm hoping that a define statement could be used. The data currently has two pieces of information concatenated together - booking number and passenger number. The booking number portion of the value can change in length, but the passenger number value is alwys the last three charcters In example 9TRS6A01A, the booking number is 9TRS6A and the passenger number is 01A. I know in excel and Access that a function can be used to count the length of the field and then use a left Function statement minus three to get only the booking number value. Does such functions exist in Web Focus or is there any other technique that I should use so I can create a field value that is only the booking number?

Thanks

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


Webfocus 76
Platform: IBM P5
Operating System: AIX
EXCEL, PDF, HTML
 
Posts: 1 | Registered: April 10, 2009Reply With QuoteReport This Post
Expert
posted Hide Post
You'll have to download the "Using Functions" manual for this. See the doc link in the upper right corner of this page. And yes, you can do this in a DEFINE or a COMPUTE.

You will first use the ARGLEN function to determine how many significant characters, not trailing spaces, are in the field. You can then use this number and some arithmetic to figure out how to use two SUBSTR functions to extract the two fields. For instance, in your example, ARGLEN would return a 9. By subtracting 3, you would know the length of the booking number, etc.

To my fellow posters, don't post the code just yet. Let's see what Cruzer can do with the hints above.

Cruzer, if this doesn't help, post again and we'll give you more clues. Wink


Ginny
---------------------------------
Prod: WF 7.7.01 Dev: WF 7.6.9-11
Admin, MRE,self-service; adapters: Teradata, DB2, Oracle, SQL Server, Essbase, ESRI, FlexEnable, Google
 
Posts: 2723 | Location: Ann Arbor, MI | Registered: April 05, 2006Reply With QuoteReport This Post
Virtuoso
posted Hide Post
Another, maybe simpler, method would be to do an edit on the right justified field. You can do this in define or compute as a one-liner: something like edit(rjust(field,.,.),'$..$999').
And Ginny is right - look up the Using Functions manual, it descibes it all.


GamP

- Using AS 8.2.01 on Windows 7 - IE11.
in Focus since 1988
 
Posts: 1960 | Location: Netherlands | Registered: September 25, 2007Reply With QuoteReport This Post
Platinum Member
posted Hide Post
You could also use the reverse() function, grab the first three characters with an edit, and then use reverse on your output to get it back to the correct value.


WF 7.7.05
HP-UX - Reporting Server, Windows 2008 - Client, MSSQL 2008, FOCUS Databases, Flat Files
HTML, Excel, PDF
 
Posts: 149 | Location: Dallas, TX | Registered: June 08, 2007Reply With QuoteReport This Post
Platinum Member
posted Hide Post
I find function in Focal Forum like Linus suggest by search "right character". I still no understand why people not use search in Focal Forum. Many other forum use search but Focal Forum have tech support as well.

Each search find me many post, I read and learn. Lots of solution very quick Smiler

Kofi


Client Server 8.1.05: Apache; Tomcat;Windows Server 2012
Reporting Server 8.1.05; Oracle; MS SQL; Windows Server 2012
 
Posts: 106 | Registered: April 06, 2009Reply With QuoteReport This Post
Master
posted Hide Post
Also download "Creating Reports with WebFOCUS Language" for your version. On very basic questions like this, you are apt to be told to read the manual.


Pat
WF 7.6.8, AIX, AS400, NT
AS400 FOCUS, AIX FOCUS,
Oracle, DB2, JDE, Lotus Notes
 
Posts: 755 | Location: TX | Registered: September 25, 2007Reply With QuoteReport This Post
Guru
posted Hide Post
They are all good sugestions.

Here's another thought. If the two pieces of information are seperated by a character (space, dash, tilde, etc) look up POSIT to help determine the length of both pieces of information. This way if the length of the passenger number ever changes, you do not have to change your code.


Glenda

In FOCUS Since 1990
Production 8.2 Windows
 
Posts: 301 | Location: Galveston, Texas | Registered: July 07, 2004Reply With QuoteReport This Post
Guru
posted Hide Post
quote:
Originally posted by Kofi:
I still no understand why people not use search in Focal Forum. Many other forum use search but Focal Forum have tech support as well.


to me such a skill would be a pre-requisite for a position here as a WF developer - the ability to take the initiative to look it up yourselves


Developer Studio 7.64
Win XP
Output: mostly HTML, also Excel and PDF

"Never attribute to malice that which can be adequately explained by stupidity." - Heinlein's Razor
 
Posts: 285 | Location: UK | Registered: October 26, 2007Reply With QuoteReport This Post
Platinum Member
posted Hide Post
While I do think it's necessary to point out to people that the there is search function for the forum, it's not always that easy when you are completely new.

I know when I first started writing reports in webfocus, I was bewildered by the conflicting choices to getting things done. Coming from a limited language background (RPG), having multiple ways to total columns (SUBTOTAL,SUB-TOTAL(WHAT?), SUBFOOT etc.) was just not getting into my thick skull. I searched, got a hundred posts but was unable to decipher which pertained to my situation.

But with the help of people like Susannah, Ginny, MGrackin, pietro, etc. And yeah, they chastised me for not searching properly, but eventually I was able to move forward and get a grip around how this WF thing works. So sometimes just asking a question and getting a reasonable answer, or just a hint on what to search for, can do more for person and get them to a point where they can be more self-sufficient, faster than just reading forums and manuals.

/RANT OFF


Lloyd Prendergast
Michael Kors (USA), Inc.
Phone: 201-453-5076
Fax: 646-354-4776
Lloyd.Prendergast@Michaelkors.com


WebFOCUS 523
WebFOCUS 7.6
WebFOCUS 7.7

Windows Server 2005
Windows Server 2008

Iseries V5R3M0
Iseries V5R5M0
Iseries V6R1M0
 
Posts: 157 | Location: Secaucus, NJ | Registered: May 21, 2004Reply With QuoteReport This Post
  Powered by Social Strata  
 

Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [CLOSED] Rookie Web Focus User question

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