I have a field in this format A:TEST:MONDAY and I only want A:TEST to display on the report. How do I evaluate the field to not display everything from the second colon on? ThanksThis message has been edited. Last edited by: Tracie,
WebFocus 7703 Windows 7 Output format: HTML, Excel, PDF
October 24, 2011, 09:19 AM
Anatess
Look up GETTOK function.
WF 8.1.05 Windows
October 24, 2011, 11:02 AM
jfr99
Hi Tracie,
Here's an example using the CAR file.
T1_TXT - Your original field T3_TXT - Your new field(Everything before the second
Or, (check out) CONTAINS. As in WHERE Field CONTAINS ':TEST:'.
October 24, 2011, 04:47 PM
Waz
I think GETTOK, POSIT then SUBSTR will do the job.
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 25, 2011, 10:50 AM
njsden
If you *always* need to get everything just before the second ":", then tokenizing your field by ":" (using GETTOK as Anatess and Waz mentioned) and capturing the first 2 tokens would give the result you need.
-SET &TKNDEL=':';
DEFINE FILE CAR
FLD/A15 WITH CAR = 'A:TEST:MONDAY';
NEWFLD/A40 = GETTOK(FLD, 15, 1, '&TKNDEL', 15, 'A15') || '&TKNDEL' ||
GETTOK(FLD, 15, 2, '&TKNDEL', 15, 'A15');
END
TABLE FILE CAR
PRINT CAR AND FLD AND NEWFLD
WHERE RECORDLIMIT EQ 1
END