AnsweredAssumed Answered

external script

Question asked by njem on Feb 4, 2015
Latest reply on Feb 5, 2015 by njem

I had a script fail to do as expected and I think I have it figured out but want to be sure so I do the right thing to avoid that in the future.

 

This is a two file system. (If I had it to do over it would be one file.) I'll call them Front and Back. Front called a script in Back. The script in Back used Go To Layout to go to one of its own layouts (that is a layout in Back), did a find, again used Go To Layout to go to another layout in Back for a table instance with a relationship (likewise the relationship is in Back). Then did some mod of the data there. That failed. From debugging it appears when it got to the 2nd layout the found set was not just one matching record but all records. This relationship and the script work if I run it directly in Back. I worked around the problem by simply staying on the first layout and setting values in the related table by using SetField(Related_Table::Field, value).

 

I'm assuming that what got me was I called a script in an external file which used layouts and relationships in that external file. Generally if I wanted to do this I would have created table instances in Front, and related them, and created a script in Front to work them. All of this just happen to already exist in Back so without thinking about it I just called the script in Back.

 

I know Front can't rely on relationships in Back. But when the script is in Back and uses tables and relationships in Back it mostly works. It gets to that first layout, does the Find correctly, and when it sets data by Related_Table::Field it works. It's just that relying on the relationship when going from one layout to another failed. Am I on the right track here?

 

Thanks,

Tom


Outcomes