Focal Point
only return records where character length is 1

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

July 23, 2008, 05:37 PM
developing
only return records where character length is 1
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!


WebFOCUS 7.6.10, Windows Vista, Oracle, Output-Excel/PDF/HTML
July 23, 2008, 05:57 PM
Darin Lee
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



In FOCUS since 1991
WF Server: 7.7.04 on Linux and Z/OS, ReportCaster, Self-Service, MRE, Java, Flex
Data: DB2/UDB, Adabas, SQL Server Output: HTML,PDF,EXL2K/07, PS, AHTML, Flex
WF Client: 77 on Linux w/Tomcat
July 23, 2008, 05:58 PM
N.Selph
WHERE ARGLEN(fieldlength, field, 'I4') EQ 1


(Prod: WebFOCUS 7.7.03: Win 2008 & AIX hub/Servlet Mode; sub: AS/400 JDE; mostly Self Serve; DBs: Oracle, JDE, SQLServer; various output formats)
July 23, 2008, 05:59 PM
Darin Lee
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



In FOCUS since 1991
WF Server: 7.7.04 on Linux and Z/OS, ReportCaster, Self-Service, MRE, Java, Flex
Data: DB2/UDB, Adabas, SQL Server Output: HTML,PDF,EXL2K/07, PS, AHTML, Flex
WF Client: 77 on Linux w/Tomcat
July 23, 2008, 09:15 PM
jimster06
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.11
W7
HTML, PDF, EXL2K
July 24, 2008, 08:58 AM
developing
Thank you all for your assistance! ARGLEN worked. It gave me the exact result I was looking for!
Have a great day


WebFOCUS 7.6.10, Windows Vista, Oracle, Output-Excel/PDF/HTML
July 24, 2008, 09:40 AM
j.gross
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 through 8.1.05