The script is missing an exit loop condition.
As written, the script looks like it will loop through all the portal rows of portal A copying a value from a field in the portal's record to a variable, but each time, it sets the first record in Portal B to the value copied.
I doubt that this is what you want your script to do.
Which row in Portal B should get the value from Portal A? Do they always have the same number of records in each portal?
Many script for doing this type of looping through portal rows are set up to use Go To Related Records in order to pull up a found set of records on a layout based on the portal's table. This avoids having to go to specific portal rows and the script simply flips back and forth between layouts as needed. But this can also trip script triggers with the layout change so you also have to look out for that complication.
Yes no exit loop in the example. forgot to add.
"As written, the script looks like it will loop through all the portal rows of portal A copying a value from a field in the portal's record to a variable, but each time, it sets the first record in Portal B to the value copied"
I wrote the example to keep it simple but the Portal B row is actually set by a global variable ie go to portal row $$Ref which has already been set on a script that runs before the one I'm building.
the script seems to set the GetActivePortalRow $$r to the Portal B list as when the loop runs $$r will only go as high as records in Portal B?
which I think is why Im having problems. What do you think?
I think that I would need to see the actual script.
To post a script to the forum:
- You can upload a screen shot of your script by using the Upload an Image controls located just below Post A Answer.
- You can print a script to a PDF, open the PDF and then select and copy the script as text from the opened PDF to your clipboard for pasting here. (with this approach, you can get multiple script steps on the same line, please edit the pasted text by inserting some returns to separate those steps.)
- If You have FileMaker Advanced, you can generate a database design report and copy the script as text from there.
- If you paste a text form of the script, you can use the Script Pretty box in the Known Bugs List database to paste a version that is single spaced and indented for a more professional and easier to read format.
I think the script that gets triggered inside the main script is messing with the result (seem to be using the same local variable name in the integral script ) If I cant solve will post for you to have a look.
Many Thanks again Phil
I think the script that gets triggered inside the main script is messing with the result
The best way to spot such interference is to use FileMaker Advanced's script debugger to watch the script execute step by step. If your script trips a script trigger, it's script will pop up in the middle of your current script and executes before control returns to the original script and you can watch it happen in the debugger and see what affect it has on your original script.