Jeff, hi I am trying to retrieve item by its id. And I tried your suggestion yesterday.
var ir:ItemReference = ds.getItem({id:userId}); Now, given the item reference (ir) how do I "connect" ir to the actual variable (me)? When I tried me = User(ir.result); Flex started compaining. Could you, please, give a code snippet? Thanks a lot --- Dmitry --- In flexcoders@yahoogroups.com, "jeffjvroom" <[EMAIL PROTECTED]> wrote: > > Either with dataService.getItem, if the item exists and you have its > id or dataService.createItem if the item does not exist and you want > to create a new one. > > If you need to actually execute a query to retrieve the item (e.g. > you are trying to retrieve a User by the lastName), you have to use > the fill method to pass in the parameters and just have that fill > method return a Collection with just one item. In this case, the > fill method returns an AsyncToken whose responder will be called when > the fill results are returned to the client. At that point, you > could look at the filled array collection and call getItemAt(0) to > get the first item in the list. > > Jeff > > --- In flexcoders@yahoogroups.com, "Dmitry Miller" <goblin77@> > wrote: > > > > I have a managed class. > > > > [Managed] > > class User > > { > > .... > > } > > > > > > and in the main application .mxml file I have a reference of this > type > > that I want to manage by a data service > > > > > > i.e. > > > > <mx:DataService id="ds" destination="userSvc" /> > > <mx:Script> > > [Bindable] > > public var me:User; > > </mx:Script> > > > > Now, how do I get to populate variable "me" and get it maneged by > userSvc? > > > > Thanks, > > > > --- Dmitry > > > -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/flexcoders/ <*> To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/