Focal Point
[SOLVED] selecting a character in a field

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

September 22, 2009, 06:12 PM
Roxanna
[SOLVED] selecting a character in a field
I am rather new to WebFocus, and I am sure there is a easy way to do this, but I am having a problem figuring this out. I only want to report a field when the second character in the field equals the letter "B".

My thought would be to create a define statemnet that reports the second letter of the field - but can't figure out how to get the define statement to only report the second position. Then I figure in my where clause I would just select the define statement when it equals B.

Thanks for your help.

This message has been edited. Last edited by: Kerry,


7.64, Windows, Excel
September 22, 2009, 06:25 PM
GinnyJakes
You can use the EDIT MASK feature:
DEFINE FILE CAR
COUNTRY2/A1=EDIT(COUNTRY,'$9');
END
TABLE FILE CAR
PRINT 
SALES
BY COUNTRY
WHERE COUNTRY2 EQ 'N'
END



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
September 22, 2009, 06:31 PM
Roxanna
Wow - that was easy. I thought Edit could only be used with Compute. Thank You!


7.64, Windows, Excel
September 23, 2009, 04:44 AM
Danny-SRL
Roxanna,

Paraphrasing Cyrano de Bergerac, here are a few variations:

If you are already using the WHERE command (as opposed to IF) you can do away with the DEFINE and write:
  
TABLE FILE CAR
PRINT 
SALES
BY COUNTRY
WHERE EDIT(COUNTRY,'$9') EQ 'N'
END


You can also use a mask in the WHERE command:
  
TABLE FILE CAR
PRINT 
SALES
BY COUNTRY
WHERE COUNTRY LIKE '_N%'
END


or, with the good old IF
  
TABLE FILE CAR
PRINT 
SALES
BY COUNTRY
IF COUNTRY EQ '$N$*'
END



Daniel
In Focus since 1982
wf 8.202M/Win10/IIS/SSA - WrapApp Front End for WF

September 23, 2009, 05:53 AM
Baillecl
Cyrano writing to Roxanna.
My God, this Forum is not for geeks only.
So many thanks, my day is enlightenned
F and C
PS : "C'était donc vous" from Roxanna to Dying Cyrano is admirable.


Focus Mainframe 7.6.11
Dev Studio 7.6.11 and !!!
PC Focus, Focus for OS/2, FFW Six, MSO
September 23, 2009, 06:43 AM
Danny-SRL
yes, but before that:
"et le samedi 26, une heure avant diner
monsieur de bergerac est mort, assassine"

[sorry no acents on my english keyboard]


Daniel
In Focus since 1982
wf 8.202M/Win10/IIS/SSA - WrapApp Front End for WF