Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

Method for copying only a portion of a field?


This topic is 6563 days old. Please don't post here. Open a new topic instead.

Recommended Posts

A solution requires that I create a script or function that accomplishes the following on command:

1. Copy a predefined portion of the email address from each record.

2. Pastes all that is AFTER the @ sign of that record into a different text field on the same record.

Simple as hell, I'm sure but not able to do it for the life of me. I know it's so simple, yet I'm stumped. Suggestion, help...please?

Specific Scenario:

One text record field (email addy) shows [email protected]

I’m looking to only extract “aol.com” from that field and place it into another field in that record. Other records have email addresses of different lenghts, so I'm looking to copy all that is after the "@" to another field in the record.

Seems like finding, copying and pasting all that is after the “@” is what I need.

Any guidance would be appreciated. Thank you.

Link to comment
Share on other sites

Cutting and pasting is not the way to go. You need to use the Set Field command with some text manipulation functions. The Position function can be used to locate the @ symbol in the text, and then the Middle function can extract the remaining text. So the Set Field command would look like this:

Set Field[Field2;Middle(Field1;1+Position(Field1;"@";1;1);99999)]

...where Field1 is the name of your original field containing the email address, and Field2 is where you want to put the extracted text.

Link to comment
Share on other sites

Ok...NOW I'm understanding...Set Field...ok......

Should I wish to only have the resulting field populate on command, what avenue then? I'm hoping to create a button (activating a script) that will accomplish all of the following:

1. See if the email addy field is populated

2. If populated, is there an "@"

3. If an "@" exists, copy all text beyond the "@" and paste it into another field.

This other field will already have "http://www." existing....you see where I'm headed?

Not seeking a "set field" actually, seeking to manually populate a field on request....you did give me the avenue to have an additional field populated at all times and I do thank you very much for that! :-) Really looking for a "script".

Link to comment
Share on other sites

But you could also do it this way:

Set variable [ $mailparts ; substitute(emailField; "@"; "¶")]

Set variable [ $domain; getvalue( $mailparts; 2)]

If not isEmpty( $domain )

Set Field [TargetURL; "http://www." & $domain]

End if

Link to comment
Share on other sites

Seems I have not been communicating effectively and I do apologise.

The result I seek will allow a user to convert one email address at a time, to a domain address by simply pressing an icon that says convert.

Only that individual record is to be effected. The avenues presented thus far do not seem to accomplish this. For that reason I'm still thinking, find, extract a portion of the field and add same to another field. Am I being clearer?...Thank you.

Link to comment
Share on other sites

... the avenue's thus far present exactly that, i don't know what you are talking about,...

In plain english, bruce's method says:

$mailpart will equal:

address¶Domain

i.e.

address

Domain

$domain will equal:

the second line of $mailpart

which -- where domain exists, will equal Domain, otherwise it will be empty

Finally, it checks to see if the domain is empty -- if it's not, you set the target url to be http://www. & the domain address

e.g. [email protected]

$mailpart =

alex

hotmail.com

$domain =

hotmail.com

$domain isn't empty so, set field

http://www.hotmail.com

That's it

THIS IS A SCRIPT AFFECTING ONLY AN INDIVIDUAL RECORD...

Make a script, attach it to a button, then it's a script attached to a button.

Also, the if statement may not actually be necessary, but that's up to you.

Link to comment
Share on other sites

This topic is 6563 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.