Jump to content

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

Recommended Posts

I have another file showing the related records of the "constellation_join" file. Say I get 3 matches. The script in the "constellation_join" file is supposed to loop through all the results, make a duplicate of each record and change two fields on each record. The script is as follows:

Goto Record/Request/Page [First]


Duplicate Record/Request

Set Field ["Ongoing CY ID", """"]

Set Field ["CPS Investigation ID", "relationship::CPS Investigation ID"]

Goto Record/Request/Page [Exit after last, Next]

End Loop

What is happening is it only goes to the first record, duplicates it, and then exits the loop. I've put pauses in, and it does list all the records in the found set (i.e. 3 out of 170), it just seems to quit after it's done with the first record.

I've done loops before, and I can't find any differences loop-wise that would be causing it to do what it's doing. I'm sure it's something completely simple, but it's driving me crazy.

Link to comment
Share on other sites

If you don't have the records uniquely sorted, then the duplicate will appear at the bottom of the found set. Then when you Go to Record/Request/Page [Exit after last, Next], you have passed the end and the loop is complete.

Try sorting the records by a unique field that will be the same in the duplicate. I usually renumber a sort field from 1 to X, and use that. Then your duplicate will appear directly underneath the current record, and Go to Record/Request/Page [Exit after last, Next] will work as desired.

Link to comment
Share on other sites

Duplicate can work 2 different ways. If the records are Unsorted it will put the duplicate at the end, which is what's happening. Hence it exits prematurely. If however you Sort the records (can be by anything, even a Constant=1, which doesn't appear to do anything), then the duplicate will be put immediately after, and it stays sorted, so you can Loop. That's what you'd want.

Link to comment
Share on other sites

This topic is 7164 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.