AnsweredAssumed Answered

Need script trigger advice

Question asked by TimMatthews on Feb 23, 2011
Latest reply on Feb 26, 2011 by TimMatthews

Title

Need script trigger advice

Post

I have a script that i want to run automatically when I exit a portal. The script sets a value to a field within a portal depending on the portal row number. The script works fine if I run it manually but I want it to run automatically when I exit the portal but when I set it to run on exit it gets caught in a loop and I have to exit FMP to stop it.

The script looks like this where "portaltable" is the table the portal points to and "portalfield1/2" are the fields in the portal table

Go to Portal Row [ Select; First ]

If [ not IsEmpty(portaltable::portalfield1) ]

Set Field [portaltable::portalfield2; "1" ]

Go to Portal Row[ Select; Next ]

If [ not IsEmpty(portaltable::portalfield1) ]

Set Field [portaltable::portalfield2; "0.5" ]

Loop

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

Exit Loop If [ IsEmpty (portaltable::portalfield1) ]

Set Field [portaltable::portalfield2; "0.25" ]

End Loop

End If

End If

Now as I said it works when I run it manually but I need help in setting an appropriate script trigger or tweeking the script in order to get it to run on exit from the portal.

Hope this makes sense

Tim

 

 

Outcomes