Jump to content

Parsing text from one field and placing in another - scripting for a button

Recommended Posts

Good morning gang!  It's been a LONG time since I've made mods to my database.  But now, due to a change in the way the data comes in from the source, we have an issue that's making things very slow in the data entry group.

Essentially, we have 2 lines of data in a field, but only need the first line of data (address number, street - ie "123 Anywhere St"), and we need that data copied to two other fields, the address number field and the street field.

Here's the field we need to copy the num and street from:


And here's the fields we need the NUM and STREET copied to:


Now, like I said, it's been a VERY long time since I wrote this database, and I'm old now and my memory is shot.  lol 
I cannot for the life of me, remember the best and most efficient way to get this done. 

We have a button we could integrate the copying of the parsed data into.  I guess I just need help with the scripting for this button.

If anyone could help with this, I'd be grateful!  Thank you in advance. :)


Link to comment
Share on other sites

The problem with a single example is that it not always represents all possible cases. It is very easy to extract the first line of text from a field using the GetValue() function. However, then comes the question where does the house number end and street name begins. If all addresses follow the same rule of house number being the first - and only the first - word in the extracted line, you could make your script do:

Set Variable [ $streetAddress ; GetValue ( YourTable::SourceField ; 1 ) ]
Set Field [ YourTable::HouseNumber ; LeftWords ( $streetAddress ; 1 ) ]
Set Field [ YourTable::StreetName ; RightWords ( $streetAddress ; WordCount ( $streetAddress ) - 1 ) ]

If you are importing the data. you could make this a part of your importing script.

Edited by comment
Link to comment
Share on other sites

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

  • Who Viewed the Topic

    1 member has viewed this topic:
  • Create New...

Important Information

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