Jump to content

problem looping through a portal


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

Recommended Posts

I tried to write a script to loop through all of the items in a portal, setting a certain field based on the value in another field (the field I am setting is visible in the portal, the field I am testing is not visible in the portal, but it is accessible through the same relationship).

My first question is, how do I choose which portal I am working with when I use the portal navigation calls?

But, my real problem is in making a loop that runs through portal rows. The problem I have is in setting the field. The test that I have

if (relationship::field = value) always uses the value in the first row of the portal to set the subsequent rows. So the loop is working (it's setting all the rows) but the If condition is only using the first row field value.

how to I do I specify a the field of the current row to do the if test?

Thanks for any help.

-wald

Link to comment
Share on other sites

This problem comes up regularly.

To make sure that you are in the correct portal, include a "Go to Field" script step that goes to a field that is only in the portal that you are concerned with. Then, go on from there.

As for looping through portal rows, you have to be careful that you don't perform a script step that causes you to jump out of the portal, or you will jump back to the first row. It's best to track the desired portal row in a global field so that you can use the "Go to Portal Row by field value" step so that you always know where you are.

I generally prefer to do my operations on related records by performing a subscript in the related file.

Link to comment
Share on other sites

I'm still having trouble.

It appears that the If test is always testing the first row, while the setfield call sets the correct row.

So, I'm looping fine, and I'm accessing the right row without a problem.

But why would the if test always test the first portal row?

By the way, in the if test, I use the relationship upon which the portal is based to access the field. Is there a way to test the portal field instead of the reltionship the portal is based on?

Thanks

-wald

Link to comment
Share on other sites

  • 3 weeks later...

quote:

Originally posted by wald:

[qb]I'm still having trouble.

It appears that the If test is always testing the first row, while the setfield call sets the correct row.

So, I'm looping fine, and I'm accessing the right row without a problem.

But why would the if test always test the first portal row?

By the way, in the if test, I use the relationship upon which the portal is based to access the field. Is there a way to test the portal field instead of the reltionship the portal is based on?

Thanks

Maybe this helps:

Cut and paste the content of the desired field in the portal to a global field and do the check on this global field .

Regards, Erik

/qb]

[ October 30, 2001: Message edited by: Erik H ]

Link to comment
Share on other sites

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