Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

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

Recommended Posts

  • Newbies
Posted

First post/question here....

I have a situation where I add items to a transaction record.

These items are displayed in a portal on the transaction record page.

Upon saving or committing the record, I need a specific field of the records displayed in the portal to change. Reflecting a change in status of the item associated with the record.

I have created a script that is triggered by a "Save/Commit" button to try to accomplish this task.

Commit Records/Request[]

Loop

Go to Portal Row [select; Next; Exit after last]

Go to Related Record[From Table: "TransactionDB"; Using Layout: "TransactionDB" (TransactionDB)]

Replace Field Contents [No dialogue; TransactionDB::ImageStatus; TransactionDB::ImageStatusTemp]

End Loop

Go to Layout [original layout]

New Record/Request

Trouble is, it seems that this script ends up on and endless loop.

What might I be doing wrong here?

Am I making a science project out of something simple?

TIA for any insight on this.

Posted

There are a couple problems with this script.

The first appears to be that you may have forgotten to check show only related records in your go to related record step which means you are replacing all the values in all the records that happen to be in your found set.

The second problem which is a little more serious, is that you are looping through a portal..... This is generally a bad idea. I would just use gtrr to get the records you want to loop over and loop over them.

The third problem which is causing you to loop forever is that when you use your go to portal row next then replace.... you actually lose your portal row because you have to commit the record you are on during the replace so you would just constantly be updating the first record in the portal.

There are some other issues with the GTRR because if you happened to leave the layout you never return to the original layout before you go to the next portal row but those don't even matter at this point.

Basically to fix this. You need to ditch the looping in the portal because it causes too many problems. I done the same thing and it's just worth the hassle to NEVER loop through a portal rows. So what you what to do is:

GTRR - records in portal - using some layout that can display these records, and make sure Show only related is checked

go to record -first

loop

Do stuff

go to record - next, exit after last

end loop

Also if you depending on what you need to change the field to you may just want to use calculations. If that's the case you save yourself a lot of work.

I hope this was helpful and I didn't mean to butcher the script but it's definitely a common mistake.

  • Newbies
Posted

SFR,

Thanks for the insight!

I'm not too sure if a calculation will do the trick.

Since the change needs to happen once the transaction record is saved/commited. Correct?

I'm going to try to re-work the script tonight.

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