IB - Developer Center    Forums  Hop To Forum Categories  FOCUS/WebFOCUS    only return records where character length is 1
Go
New
Search
Notify
Tools
Reply
  
-star Rating Rate It!  Login/Join 
Member
Posted
Hi Smiler Does anyone know how to specify in the WHERE statement of a TABLE FILE to only return those records where the value's character length is only 1? For example, I only want to see the records where the data has 'A' or 'B' but not 'A1' or 'B1' or 'C1'.
Thanks for your help!
 
Posts: 2 | Registered: September 20, 2007Reply With QuoteEdit or Delete MessageReport This Post
Virtuoso
Posted Hide Post
There is a function call ARGLEN that tests the length of a character string (not including trailing spaces.) Create a defined field using that function and then create your WHERE statement based on the defined field. Be aware that this criteria cannot be passed to the DBMS so it may be somewhat inefficient, but I can't think of another way to do it.


Regards,

Darin



WF Server: 7.1.6 on Z/OS and Linux, ReportCaster, Self-Service, MRE, Java
Data: DB2, DB2/UDB, Adabas, SQL Server Output: HTML,PDF,Excel2K
WF Client: Linux w/WebSphere, Servlet, CGI
 
Posts: 1063 | Location: Salt Lake City, Utah | Registered: February 02, 2007Reply With QuoteEdit or Delete MessageReport This Post
Guru
Posted Hide Post
WHERE ARGLEN(fieldlength, field, 'I4') EQ 1



(Prod: WebFOCUS 7.1.3: HPUX hub/Servlet Mode; various subs; mostly Self Serve; DBs: Oracle, Redbrick, JDE, SQLServer; various output formats)
(Test: WebFOCUS 7.6.4: HPUX hub/Servlet Mode; sub: AS/400 JDE; mostly Self Serve; DBs: Oracle, Redbrick, JDE, SQLServer; various output formats)
 
Posts: 275 | Location: California | Registered: April 14, 2003Reply With QuoteEdit or Delete MessageReport This Post
Virtuoso
Posted Hide Post
I guess you could also use EDIT to mask off the first character in a defined field and then test to see if your masked field is equal to the full field. However, this would not be any more efficient than ARGLEN and less straightforward.


Regards,

Darin



WF Server: 7.1.6 on Z/OS and Linux, ReportCaster, Self-Service, MRE, Java
Data: DB2, DB2/UDB, Adabas, SQL Server Output: HTML,PDF,Excel2K
WF Client: Linux w/WebSphere, Servlet, CGI
 
Posts: 1063 | Location: Salt Lake City, Utah | Registered: February 02, 2007Reply With QuoteEdit or Delete MessageReport This Post
Platinum Member
Posted Hide Post
Think about the following

WHERE MYFIELD IS '$'

This should select data where MYFIELD is fixed length field, anything appears in the first position, and the balance of the field is blank.

ref: wf713crlang.pdf p5-29

HTH


jimster06

DevStu WF 7.6.1 Tomcat WINXP
HTML, PDF, EXL2K
 
Posts: 141 | Location: USA | Registered: April 15, 2003Reply With QuoteEdit or Delete MessageReport This Post
Member
Posted Hide Post
Thank you all for your assistance! ARGLEN worked. It gave me the exact result I was looking for!
Have a great day
 
Posts: 2 | Registered: September 20, 2007Reply With QuoteEdit or Delete MessageReport This Post
Guru
Posted Hide Post
All blanks would be length zero, not one -- so if you use
WHERE MYFIELD IS '$'

you should add
AND MYFIELD NE ' '

My guess is expressing the first as

WHERE MYFIELD EQ EDIT(MYFIELD,'9');

(or an equivalent expression using SUBSTR)
increases the likelihood that it will be passed through.


- Jack Gross
WF 7.6.5, Win
 
Posts: 381 | Location: New York | Registered: January 11, 2005Reply With QuoteEdit or Delete MessageReport This Post
 Previous Topic | Next Topic powered by eve community  
 

IB - Developer Center    Forums  Hop To Forum Categories  FOCUS/WebFOCUS    only return records where character length is 1

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