« Architects & Builders | Main | Just add the table already »

April 18, 2007

TrackBack

TrackBack URL for this entry:
http://www.typepad.com/services/trackback/6a00d8341ca89053ef00d8341ccdbf53ef

Listed below are links to weblogs that reference Creating multiple child records from a list:

Comments

Søren Dyhr

I tried to make the swiching back and forth between the two layouts, one single time - guess what there is no change in speed at all, we are made to believe that the metaphor actually works mechanicly - but it doesn't!

This point is what we all know, it's not as much the algorithmic measures that count as it's the naked creation of a record. Oldfasion imports between bypasses the things going on when a record is created - are by all means the fastes method for this task, so as long as the solution isn't shared with IWP or CWP would I use the import method.

By this must I conclude that the repeating feature of the variable, more is a measure to keep the developers mind straight, than a powerfull tool in it self ...they are clumsy to set since Extend( doesn't work with them ...yet????

--sd

ErnestKoe

No recursion needed I think but instead of storing each childvalue in variable repetitions, I store it them as an old-fashion ¶ separated list. So, on the aggregate pass through it would just be a matter of writing parentid to $parentid[$n] and childvalues to $childvalues[$n] for however many [$n] records there are.

After collecting these records, we create a record for each $parentid[$n], GetValue($childvalues[$n] ; $i) for all $i items in $childvalues[$n].

-ek

Søren Dyhr

I tested my own suggestion, and no there were no significant difference to notice. But when you write you aggregate before flipping the childside, does it include the use of some custom functions of the recursive type. But here are we're on shaky ground ...since the larger the found set is, the worse is the thru-put!!!! List( which might prove a little better than recursive GetNth('s can unfortunately only be used over a relation.

I tried out with 4000 records which is dupes of your 3 original ones, but nothing beats splitting your list with:

GetValue ( Extend ( childvalues ) ; Get ( CalculationRepetitionNumber ) )

...in a calc'field and then import between tables, it takes only 11 seconds, while you original suggestion accomplish the same in a little beyond 3 and a half minute on my dozy old iBook G4.

--sd

ErnestKoe

Interesting question. Let me know if you see any performance improvements. There are other ways to optimize this but I think the biggest drag is the layout-flipping. In production work, I actually aggregate everything first, then switch layouts (context) once to write everything back out.

Søren Dyhr

I wondered if it wouldn't be a tad, faster if you made the foreign key an autoenter, instead of using a script to do so - since you use a local variable will it only live as long as the script lasts?

--sd

Verify your Comment

Previewing your Comment

This is only a preview. Your comment has not yet been posted.

Working...
Your comment could not be posted. Error type:
Your comment has been posted. Post another comment

The letters and numbers you entered did not match the image. Please try again.

As a final step before posting your comment, enter the letters and numbers you see in the image below. This prevents automated programs from posting comments.

Having trouble reading this image? View an alternate.

Working...

Post a comment