Jump to content

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

Recommended Posts

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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