Jump to content

Loops with a copy from one portal row and paste to another portal row

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

Recommended Posts

Hi - I am brand new to this forum. I have been scripting off and on for a few years with FM and have just moved to FM 5.0.

I have a script where I am looping through a set of portal rows "x" number of times. The first time through the loop, the script advances through the portal rows correctly, however, on any subsequent loops, the script skips the last portal row and double copies the first portal row.

I have a counter set up to equal the number of rows in the portal and have breaks in the loop to ensure that the counter is advanced correctly.

Any ideas????

Thanks a bunch

Danny Gillespie

Link to comment
Share on other sites

Historically, I've had mixed success looping through portal rows using the go to next portal row approach. I've also found that the concept of last portal row is sometimes a problem. What I've generally done for robustness is to keep track of the portal row number and the number of portal rows with globals and use the go to portal row number script step. I've also tested the global containing the number of portal rows against the global with the current portal row to terminate any loops. -bd

Link to comment
Share on other sites

Thanks to both of you for the replies.

The loop is supposed to loop through a particular portal (named "user") x number of times and copy the "user" portal record ID then paste it into another portal ("timesheet").

I have a counter set up that is advanced each time I perform the copy from the "user" portal and paste in the "timesheet" portal.

The loop uses the "Go to row number" script and I set the row number equal to the counter.

The issue is as follows. For example, I have 5 records in the "user" portal. The first time I loop through the "user" portal and then copy into the "timesheet" portal, I get five rows with the proper IDs (1, 2, 3, 4, 5), however, on subsequent passes through the loop I get (1, 2, 3, 4, 1).

It is about to drive me batty... Anyone else encountered this?



Link to comment
Share on other sites

I've haven't had great success navigating portal rows in scripts either. Filemaker often forgets which portal row that it's on and reverts back to row 1.

A couple of other alternatives:

Rather than loop through the portal, go to the related file instead. Find the applicable records and loop through them there. Of course, this means multiple scripts and jumping between files.

Or, if your script is creating new records in your timesheet file, you may be able to accomplish the same thing by doing an import from your user file into the timesheet file.

[This message has been edited by BobWeaver (edited January 07, 2001).]

Link to comment
Share on other sites

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