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     [SOLVED] Character count function?
Go
New
Search
Notify
Tools
Reply
  
[SOLVED] Character count function?
 Login/Join
 
Member
posted
Does anyone know a function that counts how many characters are in a field? So for example I have a field name called indexfield that contains the value '2013q1'. I want a function that would return 6 in this case. Any advice is appreciated.

Thank you
RK

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


WebFOCUS 8
Windows, All Outputs
 
Posts: 13 | Location: Long Island, New York | Registered: June 23, 2015Reply With QuoteReport This Post
Expert
posted Hide Post
Ryan, did you try searching in the documentation?

Using Functions > Character Functions > ARGLEN: Measuring the Length of a String

http://infocenter.ibi.com/wf80...tocView.jsp?view=toc


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, 2005Reply With QuoteReport This Post
Expert
posted Hide Post
In V8, there are simplified functions.

You could also look into CHAR_LENGTH(source_string)


Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.06OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Know The Code

 
Posts: 6252 | Location: 33°49'23.0"S, 151°11'41.0"E | Registered: October 31, 2006Reply With QuoteReport This Post
Member
posted Hide Post
Tried using ARGLEN couldn't really figure it out. I would really appreciate if someone provided an example of how the function works and how to use it based on the information I previously provided. Thank you in advance


WebFOCUS 8
Windows, All Outputs
 
Posts: 13 | Location: Long Island, New York | Registered: June 23, 2015Reply With QuoteReport This Post
Expert
posted Hide Post
Did you try the example in the documentation ?

TABLE FILE EMPLOYEE
PRINT LAST_NAME AND COMPUTE
NAME_LEN/I3 = ARGLEN(15, LAST_NAME, NAME_LEN);
WHERE DEPARTMENT EQ 'MIS';
END


Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.06OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Know The Code

 
Posts: 6252 | Location: 33°49'23.0"S, 151°11'41.0"E | Registered: October 31, 2006Reply With QuoteReport This Post
Gold member
posted Hide Post
Here is another example using your "indexfield" value:

TABLE FILE CAR
SUM CAR NOPRINT
COMPUTE INDEXFIELD/A10 = '2013q1';
COMPUTE INDEXFIELD_LEN/I3 = ARGLEN(15, INDEXFIELD, INDEXFIELD_LEN);
END


WebFOCUS 8.2.03
z/OS
 
Posts: 66 | Registered: May 20, 2013Reply With QuoteReport This Post
Member
posted Hide Post
Thank you for all your help. Worked out perfectly. I used this with an edit function to measure the length of a string and pull out characters similar to how you would use left, len, and right in excel.


WebFOCUS 8
Windows, All Outputs
 
Posts: 13 | Location: Long Island, New York | Registered: June 23, 2015Reply With QuoteReport This Post
Expert
posted Hide Post
Waz,

As far as I can tell, CHAR_LENGTH is a SQL function. If there are new WebFOCUS functions, I'd love to read about them.

Cheers,


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, 2005Reply With QuoteReport This Post
Expert
posted Hide Post
If you're after a function that will give you the right "n" most characters, then check out this post from 2007.

T



In FOCUS
since 1986
WebFOCUS Server 8.2.01M, thru 8.2.07 on Windows Svr 2008 R2  
WebFOCUS App Studio 8.2.06 standalone on Windows 10 
 
Posts: 5661 | Location: United Kingdom | Registered: April 08, 2004Reply With QuoteReport This Post
Expert
posted Hide Post
Francis,

Here is a link to the simplified string functions.

Simplified Character Functions


Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.06OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Know The Code

 
Posts: 6252 | Location: 33°49'23.0"S, 151°11'41.0"E | Registered: October 31, 2006Reply With QuoteReport This Post
Platinum Member
posted Hide Post
Waz, what is the path to the entry point of the Masterindex? It seems different than http://infocenter.ibi.com/wf81rel/index.jsp that I have been using to research syntax questions.


WebFOCUS 7.7.05 (Someday 8)
Windows 7, All Outputs
In Focus since 1983.
 
Posts: 103 | Registered: April 27, 2011Reply With QuoteReport This Post
Expert
posted Hide Post
The documentation hyperlinks aren't very good.

This is the URL Waz provided:

http://documentation.informati...n/source/topic64.htm

I thought this URL would get me to the "master index":

http://documentation.informati...x/html/html_wf_8104/ - this renders a 403 error

http://documentation.informati...om/masterindex/html/ - so does this

http://documentation.informati...ers.com/masterindex/ - so does this

http://documentation.informationbuilders.com navigates to https://techsupport.informatio...blic/tc-library.html

Clicking on the "8.0.x" link opens a new window with this URL: http://infocenter.ibi.com/wf80/index.jsp

This message has been edited. Last edited by: Francis Mariani,


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, 2005Reply With QuoteReport This Post
Expert
posted Hide Post
Next.

Some of the functions that are described in the documentation Waz so kindly provided appear to be NOT available in v8.0.08, v8.0.09 and v8.0.10. I assume they make their appearance in v8.1.04. It's nice that they are optimized for SQL.

Searching for "CHAR_LENGTH" points you to

WebFOCUS Release 8.0 Versions 10 and 09 > DataMigrator Functions > SQL Character Functions.

I suppose those of us unfortunates that are not on v8.1.04 or newer can give these new functions a try - perhaps they work but are hidden from us.

Thanks Waz!


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, 2005Reply With QuoteReport This Post
Expert
posted Hide Post
Should you be thankful that you are not ion the bleeding edge ?

I have to admit that the LOWER, UPPER and TOKEN function get used all the time. I don't have to go and check the structure of the function each time.


Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.06OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Know The Code

 
Posts: 6252 | Location: 33°49'23.0"S, 151°11'41.0"E | Registered: October 31, 2006Reply With QuoteReport This Post
Expert
posted Hide Post
Don't forget that you can use SQL.function, certainly against MS SQL or Oracle.

I use SQL.SUBSTR for MS SQL a lot, for, as Waz suggests, the parameters are easier to recall than the WebFOCUS SUBSTR function ... Until you can use the newer SUBSTRING function.

If the function that you want isn't supported? Then try creating your own using DEFNE FUNCTION. Just make sure that you trap the SQL to be sure that it is parsed OK into SQL and that it is efficient.

T



In FOCUS
since 1986
WebFOCUS Server 8.2.01M, thru 8.2.07 on Windows Svr 2008 R2  
WebFOCUS App Studio 8.2.06 standalone on Windows 10 
 
Posts: 5661 | Location: United Kingdom | Registered: April 08, 2004Reply With QuoteReport This Post
Platinum Member
posted Hide Post
We are going to 8.1.0.3. So I can use some and not others probably. I just wanted to see more topics than what he posted. I also found I could vary the level in the URL and get an answer for the section he posted. http://documentation.informati...n/source/topic64.htm

So I was trying to find the Welcome page for what he posted? Got anything Waz?

This message has been edited. Last edited by: Kevin W,


WebFOCUS 7.7.05 (Someday 8)
Windows 7, All Outputs
In Focus since 1983.
 
Posts: 103 | Registered: April 27, 2011Reply With QuoteReport This Post
  Powered by Social Strata  
 

Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [SOLVED] Character count function?

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