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

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

Recommended Posts

Posted

Portal Navigation

Does anyone know of a good way to navigate through successive portals within the same file?

I have a file of parts. Each part can be made up of other parts, which in turn can be made up of still other parts. When a part is ordered, the number in inventory must be deducted for itself and for all its sub-parts and their sub-parts and so on, however many levels deep it goes.

The following wouldn't work, but if it would, it's what I'm trying to do:

Script: Deduct Items

code:


Set Field [ Qty_In_Stock, Qty_In_Stock - Qty_Ordered ]

If [ IsValid( Sub-Parts::Part_ID ]

Go to Portal Row [ First ]

Loop

Go to Related Record [ Sub-Parts ]

Perform Script [ Deduct Items ]

Go to Portal Row [ Next, Exit after last ]

End Loop

End If

This is a simplification, since acutally there is a line items file between the two and a global field is used to set up a temporary connection to the record in the local file.

The reason I think this doesn't seem to work is that each script doesn't seem to track which portal row it's on. So when I go to a different record and call the script again, when I return from the recursive call, I'm not in the portal row I was in to start with.

Any help would be much appreciated.

Thanks,

Chuck

Posted

Oooh! Looping scripts and poortails. I've seen cases that should work, but don't and a few that worked for years and quit for no reason. When I use a looping script and a portal I usually keep track of the portal row explicitly with globals for both the current portal row and the total number of portal rows (goto portal row by a number in the global field). This seems to be pretty reliable.

-bd

Posted

Normally, I haven't had a problem with looping scripts in portals. It's the recursion in this case that seems to be the problem. The script needs to keep track of each portal row for each record, but it loses this when it goes to the related record to perform the same action on that record. I suppose I could try using globals, but how can I go to the related record, perform the same steps in that record, and return the the parent record, continuing down the portal? Possible a local field that stores the prior portal row number, keeping track of it for each record?

I liken what I need this to do to performing an operation with AppleScript on every item in a folder hierarchy. I perform the operation on the first item. If that item is a folder, I call the same routine, passing it the first item in the folder. AppleScript handles recursion well because each variable (such as the current item in a list) is kept when the recursive calls are made, but such is not the case with the script step Go to Portal Row. Perhaps the solution is to keep track of the portal row manually, but do so with a normal number field instead of a global field.

Any comments would be appreciated.

Thanks,

Chuck

Posted

The global approach will work, as long as you aren't jumping around between records and need to keep track of multiple current rows at one time. Using a real field will work also. If portals contents are record specific, this approach doesn't really have a downside.

-bd

  • Newbies
Posted

I don't kow if I have the answer to your question. I do have a page with two portals on it and the need to navigate through both of them, one at a time. One day, after a little cosmetic work in layout, the whole thing quit working right. The answer was to (re)arrange the two portals on different layers. i.e. send to back, bring to front etc. I had brought a sent to back portal to the front by mistake and calculations always seem to start in the back levels first. The number 2 portal was seeing the "go to portal row (last)" that should have been happening in the number 1 portal.

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