Focal Point
[CLOSED] Rookie Web Focus User question

This topic can be found at:
https://forums.informationbuilders.com/eve/forums/a/tpc/f/7971057331/m/78110728

April 15, 2009, 04:06 PM
Cruzer
[CLOSED] Rookie Web Focus User question
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
April 15, 2009, 04:34 PM
GinnyJakes
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
April 16, 2009, 02:57 AM
GamP
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 10 - IE11.
in Focus since 1988
April 16, 2009, 09:13 AM
linus
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
April 16, 2009, 09:34 AM
Kofi
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
April 16, 2009, 09:47 AM
PBrightwell
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
April 16, 2009, 10:21 AM
Glenda
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
April 16, 2009, 10:55 AM
nubi
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
April 16, 2009, 04:45 PM
Lloyd
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