Help

Using a script to replace data in a record with data from another

Topic Labels: Extensions
671 1
cancel
Showing results for 
Search instead for 
Did you mean: 
VR_Team
4 - Data Explorer
4 - Data Explorer

I know that there is a find and replace option which lets you find and then replace with text you write in, but is there a way to have a script search through a table to find a record then replace some of the data (not the stuff searched for) with datd searched for and found on another table.

i.e Rather than replace (X) with (Y), replace (Whatever is in field A on a specific record) with (something found in Field B on a linked record) which is on an second table.

1 Reply 1

Welcome to the community, @VR_Team! :grinning_face_with_big_eyes: Normally when I see a question begin with “is there a way to have a script…”, I’m ready to say “Yes”. However, I then red the end of your post:

Technically, the answer is still “Yes,” but I have a question for you: if the records are linked, why not use a lookup field to pull in any data from that linked record? No scripting required.

For example, say you have two tables: [People] and [Companies]. Records in the [People] table track each person’s individual info: name, phone, home address, etc. There’s also an {Employer} link field, where you can make a link to a record from [Companies] to indicate where they work. If you want to have their work address visible in their personal record in [People], you can add a lookup field named {Work Address} to the [People] table, using the link to their company to bring in the company’s address. If they change employers, just change the link to a new company, and that new company’s address would appear in the {Work Address} lookup field.

Is this the kind of thing you’re talking about, or is it something else?