Hi Tim,

Glad you figured it out. There's one minor change I would recommend:
when you call any of the findXXXX methods, you're always getting an
object (or a collection) back. We tried to simplify the programming
model, however the async nature of Flex's client/server integration is
always there. So even though you get back an object out of the find
calls, initially that object does not have the data. When the client
receives the data from the server, the same instance WebORB returns to
you is updated with the data. As a result, it is recommended to make
sure you actually got the data before you make any changes. Here's how
you can do it:

_master = ActiveRecords.Test.findByIdAndName('6','tessa');
_master.addEventListener( "loaded", gotTest );

public function gotTest( evt:DynamicLoadEvent ):void
{
  var testObj:Test = (evt.data as ArrayCollection)[0] as Test;
  testObj.Email = "[EMAIL PROTECTED]";
  testObj.Name = "tessa";
}

Cheers,
Mark


--- In flexcoders@yahoogroups.com, "timgerr" <[EMAIL PROTECTED]> wrote:
>
> OK, I found out how to do this.  When updating a row I have to specify
> the row id, I think that is all. That is how I got it to work.
> 
> So if I have this 
> _master = ActiveRecords.Test.findByIdAndName('6','tessa');
> _master[0].Email = "[EMAIL PROTECTED]";
> _master[0].Name = "tessa";
> _master[0].Id = 6;
> 
> 
> I then create the test method (I think that is what you call it)
> var i:Test = new Test();
> i.Name = Tess;
> i.Email = "[EMAIL PROTECTED]";
> i.Id = 6;
> var asyncToken:AsyncToken = null;
> asyncToken = i.save();
> asyncToken.addResponder(new mx.rpc.Responder (OnCreated,OnFault));
> 
> That is it, that is how I got it to work.  Man this Weborb rocks.  I
> have a few other questions that I will be posting
> 
> 
> 
> --- In flexcoders@yahoogroups.com, "timgerr" <tim.gallagher@> wrote:
> >
> > Let me make this a little more clear:
> > I am good at looking at code so here is what I am doing.  I want to
> > call a database row using findby and ad that information into an array
> > collection:
> > private var _master:ArrayCollection = new ArrayCollection(); 
> > _master = ActiveRecords.Test.findByIdAndName('6','tessa');
> > 
> > so now master[0] has Id, Email, Name
> >  so if I wanted to change the name from tessa to
> > tess, not sure what to do.
> > 
> > Thanks for the read.
> > timgerr
> > 
> > 
> > --- In flexcoders@yahoogroups.com, "timgerr" <tim.gallagher@> wrote:
> > >
> > > Mark, Thanks for the reply, I am getting closer to learning how
to do
> > > an update.
> > > 
> > > I am good at looking at code so here is what I am doing.  I want to
> > > call a database row using findby and ad that information into an
array
> > > collection:
> > > private var _master:ArrayCollection = new ArrayCollection(); 
> > > _master = ActiveRecords.Test.findByIdAndName('6','tessa');
> > > 
> > > so now master[0] has Id, Email, Name
> > > so if I wanted to change the email from tsa@ to
> > > tsa@, I do this?
> > > 
> > > private var uDate:Test = new Test();
> > > uDate.Name = 'tessa';
> > > uDate.Id   = '6';
> > > udate.Email = 'tesa@';
> > > 
> > > var asyncToken:AsyncToken = null;
> > > asyncToken = uDate.save();
> > > 
> > > How does webord know the difference between an updated and new
record?
> > > 
> > > Thanks for the help,
> > > timgerr
> > > 
> > > 
> > > 
> > > --- In flexcoders@yahoogroups.com, "Mark Piller" <mark@> wrote:
> > > >
> > > > Hi Tim,
> > > > 
> > > > For any instance of Active Record on the client side you can
change
> > > > the properties and then call save() on that instance. It will
update
> > > > the record in the database and also issue client synchronization
> event
> > > > so other clients that have the same record would be updated.
> Instances
> > > > of active record are loaded with any of the findXXX methods.
> > > > 
> > > > Hope this helps.
> > > > 
> > > > Mark
> > > >
> > >
> >
>


Reply via email to