Darshana,
You are doing about what I was going to suggest whenever I read your
original post.
I was thinking something like the following though:
Lets say that $MTNNS$ contains the following:
[EMAIL PROTECTED], [EMAIL PROTECTED], [EMAIL PROTECTED], [EMAIL PROTECTED],
Step 1:
Set Fields:
tmpEmail = SUBSTR($MTNNS$, 0, (STRSTR($MTNNS$, ",")-1))
Step 2:
If NOT('MTNNS' LIKE ("%" + $tmpEmail$ + "%"))
Set Fields:
'tmpFullEmailString' = $tmpFullEmailString$ + "," +
$tmpEmail$
ELSE:
Set Fields:
'tmpEmail' = $NULL$
Step 3:
Set Fields
'MTNNS' = (SUBSTR($MTNNS$, (STRSTR($MTNNS$, ",") + 1)))
Step 4:
Loop until $MTNNS$ is empty or just a ",".
What this should do:
First Iteration:
Step 1: Set tmpEmail = [EMAIL PROTECTED]
Step 2: ELSE: Set tmpEmail = $NULL$ because MTNNS contains $tmpEmail$
Step 3: Set MTNNS = [EMAIL PROTECTED], [EMAIL PROTECTED],
[EMAIL PROTECTED],
LOOP because MTNNS is not "" or ","
Second Iteration
Step 1: Set tmpEmail = [EMAIL PROTECTED]
Step 2: Set 'tmpFullEmailString' = $NULL$ + [EMAIL PROTECTED]
Step 3: Set MTNNS = [EMAIL PROTECTED], [EMAIL PROTECTED],
LOOP because MTNNS is not "" or ","
Third Iteration
Step 1: Set tmpEmail = [EMAIL PROTECTED]
Step 2: Set 'tmpFullEmailString' = [EMAIL PROTECTED],
[EMAIL PROTECTED]
Step 3: Set MTNNS = [EMAIL PROTECTED],
LOOP because MTNNS is not "" or ","
Fourth Iteration
Step 1: Set tmpEmail = [EMAIL PROTECTED]
Step 2: Set 'tmpFullEmailString' = [EMAIL PROTECTED],
[EMAIL PROTECTED], [EMAIL PROTECTED]
Step 3: set MTNNS = ""
Step 4: EXIT because MTNNS = ""
I think this should work for you. You are chopping off the first
occurrence of the email address instead of all subsequent ones, I hope
that's not a problem.
Thanks,
Gary Opela, Jr
Sr. Remedy Developer
Leader Communications, Inc.
405 736 3211
-----Original Message-----
From: Action Request System discussion list(ARSList)
[mailto:[EMAIL PROTECTED] On Behalf Of Darshana Jivan [MTN Network
Solutions]
Sent: Friday, March 07, 2008 8:34 AM
To: [email protected]
Subject: Remove duplicate email address from a String
**
Hi,
Please can someone assist me with the following.
I want to remove duplicate email addresses in a string. I cannot create
a view with the distinct values as I need the unique id's of the record
therefore the only option I do have is to try and remove duplicate
occurrences after the 1st occurrence of an email address.
This is the following process that I am using but I know that the last
set fields with the replace function is not doing what I require it to
do and there is where I need some assistance.
I have a AL that fetches and email address and concatenates it to a
string in a loop.
SQL Command: SELECT CONTACT_EMAIL FROM [EMAIL PROTECTED] WHERE
CONTACT_ID = '$Col_C_ContactID$'
Set Fields 1: Email
$1$
Set Fields 2: MTNNS_primary_client_contact_email
($MTNNS_primary_client_contact_email$ + ",") + $Email$
I then have another AL that does the following when it finds a match of
an email address in the string 'MTNNS_primary_client_contact_email'
Set Fields 1: Val1
STRSTR($MTNNS_primary_client_contact_email$, $Email$)
Set Fields 2: Val2
LENGTH($Email$)
Set Fields 3:
REPLACE($MTNNS_primary_client_contact_email$,
SUBSTR($MTNNS_primary_client_contact_email$, $Val1$, $Val2$), "")
In essence if I have a table with the following email addresses and when
its looped through the string or the value I am looking for is
[EMAIL PROTECTED], [EMAIL PROTECTED], [EMAIL PROTECTED] the duplicate
occurrence should be extracted from the string.
[EMAIL PROTECTED]
[EMAIL PROTECTED]
[EMAIL PROTECTED]
[EMAIL PROTECTED]
[EMAIL PROTECTED]
__Platinum Sponsor: www.rmsportal.com ARSlist: "Where the Answers Are"
html___
_______________________________________________________________________________
UNSUBSCRIBE or access ARSlist Archives at www.arslist.org
Platinum Sponsor: www.rmsportal.com ARSlist: "Where the Answers Are"