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 RKThis message has been edited. Last edited by: <Kathryn Henning>,
WebFOCUS 8 Windows, All Outputs
October 06, 2015, 04:48 PM
Francis Mariani
Ryan, did you try searching in the documentation?
Using Functions > Character Functions > ARGLEN: Measuring the Length of a String
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
October 06, 2015, 05:17 PM
Waz
In V8, there are simplified functions.
You could also look into CHAR_LENGTH(source_string)
Waz...
Prod:
WebFOCUS 7.6.10/8.1.04
Upgrade:
WebFOCUS 8.2.07
OS:
Linux
Outputs:
HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!
October 06, 2015, 05:17 PM
Ryan K.
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
October 06, 2015, 05:25 PM
Waz
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.04
Upgrade:
WebFOCUS 8.2.07
OS:
Linux
Outputs:
HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!
October 07, 2015, 06:33 AM
Joel Elscott
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
October 07, 2015, 10:38 AM
Ryan K.
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
October 07, 2015, 11:19 AM
Francis Mariani
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
October 07, 2015, 11:44 AM
Tony A
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
October 07, 2015, 04:57 PM
Waz
Francis,
Here is a link to the simplified string functions.
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.
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
October 08, 2015, 10:38 AM
Francis Mariani
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
October 08, 2015, 05:09 PM
Waz
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.04
Upgrade:
WebFOCUS 8.2.07
OS:
Linux
Outputs:
HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!
October 09, 2015, 05:58 AM
Tony A
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
October 09, 2015, 10:11 AM
Kevin W
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.