Focal Point Banner


As of December 1, 2020, Focal Point is retired and repurposed as a reference repository. We value the wealth of knowledge that's been shared here over the years. You'll continue to have access to this treasure trove of knowledge, for search purposes only. Moving forward, myibi is our community platform to learn, share, and collaborate. We have the same Focal Point forum categories in myibi, so you can continue to have all new conversations there. If you need access to myibi, contact us at myibi@ibi.com and provide your corporate email address, company, and name.


Connect to myibi
Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [SOLVED]returning a substring of an email

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[SOLVED]returning a substring of an email
 Login/Join
 
Platinum Member
posted
I would like to get everything that appears before the @ symbol in a list of emails and was wondering the best way to do this. Thought we could get the position of the @ symbol then do a substring on the field up to that position. Has anyone done this?

for example want to return johndoe from the email johndoe@hp.com

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


WF8
Windows
 
Posts: 117 | Registered: May 28, 2015Report This Post
Guru
posted Hide Post
There is a special function for that, use GETTOK and use @ as a delimiter.


Test: WF 8.2
Prod: WF 8.2
DB: Progress, REST, IBM UniVerse/UniData, SQLServer, MySQL, PostgreSQL, Oracle, Greenplum, Athena.
 
Posts: 454 | Location: Europe | Registered: February 05, 2007Report This Post
Platinum Member
posted Hide Post
DEFINE FILE CAR
CNTRY/A10 = LOCASE(10, STRIP(10, COUNTRY, ' ', 'A10'), CNTRY);
EMAIL/A30 = CNTRY || '@whatever.com';
TOKEN/A10 = GETTOK(EMAIL, 30, 1, '@', 10, TOKEN);
END
-*
TABLE FILE CAR
PRINT
CNTRY
EMAIL
TOKEN
BY COUNTRY
END


WebFocus 8.201M, Windows, App Studio
 
Posts: 227 | Location: Lincoln Nebraska | Registered: August 12, 2008Report This Post
Expert
posted Hide Post
FYI

As you seem to be on WF8, there is a new function called TOKEN, much simpler than GETTOK.

VAR = TOKEN(string,delimiter,token number)


Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.07OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!

 
Posts: 6349 | Location: 33°49'23.0"S, 151°11'41.0"E | Registered: October 31, 2006Report This Post
Platinum Member
posted Hide Post
Thanks Waz ...

DEFINE FILE CAR
CNTRY/A10 = LOCASE(10, STRIP(10, COUNTRY, ' ', 'A10'), CNTRY);
EMAIL/A30 = CNTRY || '@whatever.com';
TOKEN/A10 = GETTOK(EMAIL, 30, 1, '@', 10, TOKEN);
VAR01/A10 = TOKEN(EMAIL,'@',1);
END
-*
TABLE FILE CAR
PRINT
CNTRY
EMAIL
TOKEN
VAR01
BY COUNTRY
END


WebFocus 8.201M, Windows, App Studio
 
Posts: 227 | Location: Lincoln Nebraska | Registered: August 12, 2008Report This Post
Platinum Member
posted Hide Post
Thanks all, the GETTOK worked but I think I will try the TOKEN as well.


WF8
Windows
 
Posts: 117 | Registered: May 28, 2015Report This Post
Guru
posted Hide Post
There's an even easier way in 8.2, a new function SPLIT where you can specify the part of the email address you want to extract: EMAIL_USERID or EMAIL_DOMAIN.
VAR02/A10 = SPLIT( EMAIL_USERID, EMAIL )  


N/A
 
Posts: 397 | Location: New York City | Registered: May 03, 2007Report This Post
  Powered by Social Strata  

Read-Only Read-Only Topic

Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [SOLVED]returning a substring of an email

Copyright © 1996-2020 Information Builders