Jump to content

synchronizing records script


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

Recommended Posts

Thank you ahead of time for your help! This is a great site for getting over mental speed bumps...

what would be wrong with this script? I'm not wanting it to, but It's copying every field over from the next record.

I'm trying to copy the contents cell/field by cell/field of a record that has more contents than the newest record that is basically a duplicate. For example the new record may have only an updated mailing address, but the other duplicate record may have all of their other info like phone numbers, emails, etc that is still accurate and needs to be kept. So, in an effort to merge the two records, I only want the script to copy the contents of a cell is if the newest record has a blank cell...

And is there an easier or better way to do this?

Currently, I have:

duplicate = already flagged with 'new' if it is a duplicate and the newest one

synchronizer field = global that holds the value of the current fields contents

Enter Browse Mode

Sort [ Restore sort order, No dialog ]

Go to Record/Request/Page [ First ]

Go to Layout [ Long Duplicate checker ]

Go to Field [ duplicate ]

If [ duplicate = "new" ]

Loop

Go to Next Field

Copy [ ] [ Select entire contents ]

Set Field [ synchronizer field ]

If [ synchronizer field = "" ]

Go to Record/Request/Page [ Next ]

Copy [ ] [ Select entire contents ]

Go to Record/Request/Page [ Previous ]

Paste [ ] [ Select entire contents ]

Exit Loop If [ synchronizer field = "new" ]

End If

End Loop

End If

Thank you again!

HowardCrut

Version: v5.x

Platform: Mac OS 9

Link to comment
Share on other sites

I assumed/hoped that by not specifying a result that it would basically put what is on the clipboard from the previous step: Copy [ ] [ Select entire contents ].

Then is there a way to: Set Field [ synchronizer field, <<contents on the clipboard>> ]

without entering that field. Because if it enters the field then the rest of the script would not work - b/c the current field would become 'synchronizer field'.

More detailed example:

Record1 =

duplicate = "new"

first = "Fred"

last = "Smith"

address = "100 Main St."

phone = ""

email = ""

Record 2 =

duplicate = ""

first = "Fred"

last = "Smith"

address = "333 South First" #outdated address

phone = "555-1212"

email = "[email protected]"

Script should go through each field in Record1 b/c Duplicate = 'new'. Once it finds a field that is empty, it would copy the contents from Record2. Result would be:

Record1 =

duplicate = "new"

first = "Fred"

last = "Smith"

address = "100 Main St."

phone = "555-1212"

email = "[email protected]"

with new address (replacing the old one), and copied phone & email b/c Record1 phone and email fields were blank.

There are too many fields (about 60) to do them individually by name, so using a global to hold the value of the current field of the current record seems to me the quickest way.

Any ideas?

Thanks- HowardCrut

Link to comment
Share on other sites

If you want to insert the contents of the clipboard into a field, use the Copy [] script step. Be sure to specify the field name, and note that the field must be on the current layout when the script runs for Copy to work.

Link to comment
Share on other sites

yes, but my real question is can I specify a field name without mentioning it by it's actual name. I'm having difficulty determining if a cerrent field was empty without actually referencing it by name.

ie: If [ ***CURRENTFIELD*** = "" ] :???

or: If IsEmpty(***CURRENTFIELD***)

Modified the script below, but I'm stuck on this one step...

Enter Browse Mode

Sort [ Restore sort order, No dialog ]

Go to Record/Request/Page [ First ]

Go to Layout [ Long Duplicate checker ]

Go to Field [ duplicate ]

If [ duplicate = "new" ]

Go to Record/Request/Page [ Next ] #THIS ACTIVATES THE RECORD

# I WANT TO COPY FROM

Go to Record/Request/Page [ Previous ] #GOES BACK TO RECORD

#I WANT TO PASTE/INSERT INTO

Loop

Go to Next Field

If [ ***CURRENTFIELD*** = "" ] ??????

INSERT FROM LAST RECORD [select entire contents]

Exit Loop If [ ***CURRENTFIELD*** = "new" ] #BACK AT FIRST CELL, SO EXIT

End If

End Loop

End If

-----

obviously I could say:

If [ first = "" ] - Insert from Last Record

If [ last = "" ] - Insert from Last Record

If [ phone = "" ] - Insert from Last Record, etc.

but I'm hoping I can do this without having to do each of them separately, since there are so many and new fields are added all of the time which would force this script to manually be continually updated.

To elaborate a bit more, in the 'Copy []' function, if you do not specify the field, then it just copies from the current field, same thing with 'Paste []'. I want to say IsEmpty() to find out if the current field is empty without specifying the field.

Thank you for your help!

Link to comment
Share on other sites

You could use IsEmpty(Status(CurrentFieldName)) or IsEmpty(Status(CurrentFieldContents)) (for a repeating field).

...

Go to Next Field

If [ IsEmpty(Status(CurrentFieldContents) ]

Go to Record/Request/Page [ Next ]

Set Field [gSynch, Status(CurrentFieldContents)]

Go to Record/Request/Page [ Previous ]

Set Field [ ,gSynch]

...

Will this work for you?

Link to comment
Share on other sites

THANK YOU!!

I knew there was a feature to do what I needed.

I didn't know of the "Status" feature...

Status(CurrentFieldContents)

Now working:

Go to Record/Request/Page [ First ]

Go to Field [ duplicate ]

If [ duplicate = "new" ]

Go to Record/Request/Page [ Next ]

Go to Record/Request/Page [ Previous ]

Loop

Go to Next Field

If [ IsEmpty(Status(CurrentFieldContents)) ]

Insert from Last Record [ ] [ Select entire contents ]

End If

Exit Loop If [ Status(CurrentFieldContents) = "new" ]

End Loop

End If

Thanks so much for the help!

-howard

Link to comment
Share on other sites

This topic is 6519 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
 Share

×
×
  • Create New...

Important Information

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