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

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

Recommended Posts

Posted

Could someone please take a look at the following script and see what's wrong:

Open is a field in Parent that counts the nbr of “empty” child records in CHILD.

I want the script to do the following things:

If Open < 10

Go to CHILD table

Create new record, put “A” in Source (in Child table)

Repeat the above step until Open reaches 10

When Open reaches 10 Stop the loop and Exit.

Expl: If Open = 6, when triggered the script should create 4 new records in CHILD.

The script:

IF [PARENT::Open < 10]

Go to layout [CHILD]

Loop

NewRecord/Request

SetField [CHILD::Source; “A”]

Exit Loop IF [PARENT::Open = 10]

End Loop

End If

The script is acting as if when records are created in child, either Open is not updated/or the script is not reading the value in Open and keeps creating records endlessly. When I abort the script a large nbr of records have been created and Open shows this large nbr.

Posted

What is the field definition for Open? If it's an aggregate calc, you may need to commit the records before the calc will update.

Posted (edited)

Open = Sum(CHILD::Source)

I added CommitRecord before the ExitLoopIF step, no change the loop keeps looping.

Edited by Guest
Posted

I see two problems:

1. Sum(CHILD::Source) does not work on text values. You might try count() instead.

2. The new Child records are missing a foreign key that would link them to a Parent record, so the reference to the parent "Open" field won't show a value anyway. You would need to store the parent key in a global and set that in each new record's foreign key.

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