Thanks:  0
Likes:  0
Dislikes:  0

# Thread: Looping statement to create multiple records

1. ## Looping statement to create multiple records

Say you had an app. that has a requirement for every person in a household that they must be related to each other.
So say you had a customerA and 10 children, all 10 children would have to be related to CustomerA, they would then also have to be related to one another so say you had ChildA, ChildB and ChildC. You would need relationships like ChildA is a sibling of ChildB and ChildB is a Sibling of ChildA.
Then ChildC is a Sibling of ChildA and ChildC is a Sibling of ChildB. I need to write a function that will create all permutations of this, anyone got any ideas as regards using loops to do this?

2. ## Re: Looping statement to create multiple records

Sounds like a tree to me. Read up on how to create and navigate your way around a tree.

There are a number of file directory tree functions in the Download files section. Browsing the code should give you a few pointers from which to start. If you think of each dir is a parent and the files as children, you should see the metaphor.

On the face of it it's a straightforward data structure, although I'd query with the Analyst the reliability of the assumption that everyone in a household *must* be related to each other.

Not sure about the 'all permutations' though, are there any? From what you've written, if you assume a tree structure then it follows that (if you've set the tree up correctly) all children for a given parent *must* be siblings.

Your testing can therefore be simplified to checking app behaviour for a singleton parent and/or child and multiple children. If your developers are fond of cutting corners, you might broaden that out to specifically checking how the app behaves when processing the first/last parent and first/last child, or explore whether there are limits that constrain the number and levels of parents/children you can have.

Regards
Peat

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•
Search Engine Optimisation provided by DragonByte SEO v2.0.36 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.