Greg,
  My apologies for not getting back to the board sooner but at least I
come bearing solutions.
  The problem was both an Adobe bug and problems with my code and the
dB.  Like the perfect storm it all came together to deny me the simple
pleasure of an INSERT operation. Flex updater 2.0.1 fixed the child
form INSERT problem (Thank you very much to Farah Gron and her team
for working with me and including the fix in the update).  For a child
form (usually a dataGrid) inside a parent, the ArrayCollection that
holds the child data is not populated correctly when adding a new
record.  The fix was to "force the array from the array collection"
with this line:
this.detailObject.childBeans = getChildBeansArray();

The wizard now puts this line just above this.datamanager.save(item)
in the function saveItem(item:Object)

Okay, that fixed Adobe's bug but still didn't work for me completely.
In order to get the primary key from the parent table and insert it as
the foreign key in the child, the wizard uses a SELECT statement with
a WHERE clause that uses every field from the parent table.  That
might work and might not.  In my case, several of those fields were
not part of the parent form and so contained nulls (why my dB allowed
nulls is a matter I'll have to discuss with my DBA  -- oh yeah, that's
me-- shoot!).  What do you get when the WHERE clause returns nulls? 
You got it, nothing. I deleted those fields from the WHERE clause and
added a timestamp to ensure I got the right foreign key and all is
well in Flex land.

PS  the dB no longer allows nulls  -- duh
Thanks for your input Greg.  It got me looking and helped out a great
deal.

Cheers,
Dan


--- In flexcoders@yahoogroups.com, "greg h" <[EMAIL PROTECTED]> wrote:
>
> Dan,
> 
> Your writing the following makes me wonder if there might not be a
> conditional block somewhere that results in the "INSERT child"
statement not
> being executed.  You wrote:
>   >>  The INSERT for the child table simply isn't even attempted.
> 
> That would be sensible since executing "INSERT child" without the
necessary
> foreign key would result in an error at run time :-)  Could you
check the
> code around whatever calls the insert for any IF/ELSE logic?
> 
> Where the initial subject line was "fails silently", maybe the error
is that
> there is no logic to select back the newly inserted primary key for the
> PARENT, causing conditional logic to skip "INSERT child" since, again,
> executing "INSERT child" without the foreign key would result in a
runtime
> error.
> 
> So now I really, really am curious.  So please do post back once you
get it
> all working.
> 
> g
> 
> 
> On 12/20/06, nall_daniel <[EMAIL PROTECTED]> wrote:
> >
> > Thanks Greg,
> >   Your advice is appreciated and helpful.  I'm using MS SQL server, CF
> > 7.02, and of course Flex 2.  I have nothing in my CF logs, nothing in
> > SQL logs (SQL errors show up in the browser anyway ie
> > fault="server_fault(event)").  I use the Flash Tracer extension for
> > Firefox (very helpful BTW) and see nothing there either.  The INSERT
> > for the child table simply isn't even attempted.  I've contacted Adobe
> > and they have verified the problem and submitted it as a bug.  In the
> > meantime, I have done this with CF flash forms before so I'll try the
> > same technique I used there. INSERT parent, Lock the dB, grab primary
> > key, INSERT child, release lock.  We'll see.  If I can get it working
> > I'll definately post a solution.  Hopefully Adobe will beat me to the
> > punch.  Thanks again...
> >
> > Dan
> >
>


Reply via email to