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

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

Recommended Posts

Posted

I need help on this script. I have a layout with 3 different portal tables and the script should make a duplicate record and also duplicate the 3 portal tables. The script works fine with one table but it wont Loop/repeat the other 2, whats wrong with the script?

Thanks

#

#

#

Set Variable [ $OrigWindowName; Value:Get ( WindowName ) ]

Go to Related Record [ From table: “oil_quantities”; Using layout: “oil_quantities” (oil_quantities) ]

[ Show only related records; New window ]

Select Window [ Name: $OrigWindowName ]

Duplicate Record/Request

Set Variable [ $NewRecipeID; Value:recipes::recipe_id ]

Select Window [ Name: "OilDupes" ]

#

#

# Duplicate Oils

Go to Record/Request/Page

[ Last ]

Loop

Duplicate Record/Request

Set Field [ oil_quantities::recipe_id; $NewRecipeID ]

Omit Record

Omit Record

Exit Loop If [ Get ( FoundCount ) = 0 ]

End Loop

# Duplicate adds

Go to Record/Request/Page

[ Last ]

Loop

Duplicate Record/Request

Set Field [ add_quantities::recipe_id; $NewRecipeID ]

Omit Record

Omit Record

Exit Loop If [ Get ( FoundCount ) = 0 ]

End Loop

# Duplicate EOs

Go to Record/Request/Page

[ Last ]

Loop

Duplicate Record/Request

Set Field [ eo_quantities::recipe_id; $NewRecipeID ]

Omit Record

Omit Record

Exit Loop If [ Get ( FoundCount ) = 0 ]

End Loop

Close Window [ Current Window ]

Commit Records/Requests

[ Skip data entry validation; No dialog ]

Posted

#

#

# Duplicate Oils

Go to Record/Request/Page

[ Last ]

Loop

Duplicate Record/Request

Set Field [ oil_quantities::recipe_id; $NewRecipeID ]

Omit Record

Omit Record

Exit Loop If [ Get ( FoundCount ) = 0 ]

End Loop

[color:red]

>>>>>>

# Duplicate adds

Go to Record/Request/Page

[ Last ]

Loop

Duplicate Record/Request

Set Field [ add_quantities::recipe_id; $NewRecipeID ]

Omit Record

Omit Record

Exit Loop If [ Get ( FoundCount ) = 0 ]

End Loop

After duping the first set of records, you're left with no found records and you start your next loop.

Running this with the Script Debugger on should should you this issue.

Posted

tmas,

Have you considered a scripted import instead of fussing with loops?

GTRR: primary--> childrenPortal1

Spawn a new CHILD window. Import.

Close Window

Back to original screen

GTRR: primary --> childPortal2

etc...

Often much faster than looping scripts for the creation of new records.

If you need to set some values, loop through the found set after the import.

Good luck!

*susan*

Posted

So should I repeat the whole top script step? Like this? Sorry but I dont understand the way it repeats.

Set Variable [ $OrigWindowName; Value:Get ( WindowName ) ]

Go to Related Record [ From table: “oil_quantities”; Using layout: “oil_quantities” (oil_quantities) ]

[ Show only related records; New window ]

Select Window [ Name: $OrigWindowName ]

Duplicate Record/Request

Set Variable [ $NewRecipeID; Value:recipes::recipe_id ]

Select Window [ Name: "OilDupes" ]

# Duplicate Oils

Go to Record/Request/Page [ Last ]

Loop

Duplicate Record/Request

Set Field [ oil_quantities::recipe_id; $NewRecipeID ]

Omit Record

Omit Record

Exit Loop If [ Get ( FoundCount ) = 0 ]

End Loop

Set Variable [ $OrigWindowName; Value:Get ( WindowName ) ]

Go to Related Record [ From table: “eo_quantities”; Using layout: “eo_quantities” (eo_quantities) ]

[ Show only related records; New window ]

Select Window [ Name: $OrigWindowName ]

Duplicate Record/Request

Set Variable [ $NewRecipeID; Value:recipes::recipe_id ]

Select Window [ Name: "EoDupes" ]

# Duplicate EOs

Go to Record/Request/Page [ Last ]

Loop

Duplicate Record/Request

Set Field [ eo_quantities::recipe_id; $NewRecipeID ]

Omit Record

Omit Record

Exit Loop If [ Get ( FoundCount ) = 0 ]

End Loop

Posted

Something like this? But how does it know to import this record?

Go to Related Record [ From table: “oil_materials”; Using layout: “oil_detail” (oil_materials) ]

[ Show only related records; New window ]

Import Records [ ]

[ No dialog ]

Close Window [ Current Window ]

Go to Layout [ “recipes” (recipes) ]

Posted

You will need a "shadow table".... I will create a demo file for you. Much easier than describing the process.

Duplicating this way only makes sense if the routine is going to be used more than once, i.e. a regular part of the workflow.

*susan*

Posted

Got a call from a client... sorry to take so long to create the demo file. This is the general jist though. Think about how to preserve the found set before starting the routine, so that you can return the user to a logical point.

Hope this helps!

*susan*

DuplicateWithImport.fp7.zip

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