On Jun 25, 2:36 pm, hedgomatic <hedgoma...@[EMAIL PROTECTED]
> wrote:
> I'm creating a script that will duplicate a record and all its related
> records. I've broken it down into a primary script and several
> subscripts:
>
> ---------------------------------------------------------------
> subscript #1: "Isolate Project by ProjectID"
> ---------------------------------------------------------------
> * Go to Field [Projects::Project ID]
> * Set Variable [$isolateID; Value:Get(ActiveFieldContents)]
> * Enter Find Mode[]
> * Set Field [Projects::ProjectID;$isolateID]
> * Perform Find[]
>
> # this gives us a result window with only the current active record
>
> ---------------------------------------------------------------
> subscript #2: "Select Related Project Tasks"
> ---------------------------------------------------------------
> * Go to Related Record [Show only related records; From table:
> "Project Tasks"; External; Using layout: "Form View" (project_tasks);
> New window]
> * Select Window [Name: "project_tasks"]
>
> # Self explanatory: Opens a result set in the "project tasks" window
> for all records related to the currently selected record.
>
> ---------------------------------------------------------
> Primary Script: "Duplicate Project"
> ---------------------------------------------------------
> * Perform Script ["Isolate project by ProjectID"] #see above
> * Go to Field [Projects::ProjectID]
> * Set Variable [$$originID; Value:Get(ActiveFieldContents)] #get the
> original project ID
> * Duplicate Record/Request
> * Go to Field [Projects::ProjectID]
> * SetVariable[$$destinationID;Value: Get(ActiveFieldContents)] # get
> the ID of our new entry
> * Go to Record/Request/Page [Previous] #back to the original
> * Perform Script ["Select Related Project Tasks"] # see above
> * Pause/Resume Script [Indefinitely] # tossed this here to debug
>
> (etc)
>
> Subscript #2 runs exactly as expected when executed standalone,
> however when I run it from the Primary script, upon opening the result
> set, the script instantly reverts back to the parent window with the
> Projects::projectID field selected. Even if I stop script execution
> here, I can't select my new "project_tasks" window.
>
> There doesn't seem to be a command to de-select a field...I've tried
> closing the projects window, which results in it simply opening it up
> in a new window again. The select window command in my subscript
> doesn't seem to help either.
>
> Any suggestions greatly appreciated.
I'm a little unclear as to what the subscript #2 is doing, but why do
you have a Select Window[] step if you want the new window to be
current?
Also it would help to know, why are the related records in an external
db? What are you naming your new window in the GTRR? Is Current File
unchecked in your Select Window script step?
And finally, a couple bits of advice on another part of the script...
-Drop the Go to Field[]s,
-In the Set Variable[]s, change Get(ActiveField Contents) to just the
field name.


|