Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Adobe AIR Development

New Developer
Posts: 5
Registered: ‎11-04-2010
My Device: Not Specified
Accepted Solution

Acessing data from a DataProvider

This should be easy but I'm not getting it for some reason.


I have an sql statement that returns a dataprovider from the database.  It should always return 1 record in the dataprovider but if not I want to view one of the fields from the first record.


Here's the code snippet that gets the data from the database:


var resultSmiley FrustratedQLResult = sqlStatement.getResult();

var dpSmiley Very HappyataProvider = new DataProvider();
for each(var objSmiley Surprisedbject in result.data) {
    if (obj != null) {
    dp.addItem({idSmiley Surprisedbj["id"], usernameSmiley Surprisedbj["username"], password:["password"]});


In that example how do I display the username after it is in the dataprovider?

Posts: 2,462
Registered: ‎11-04-2010
My Device: Bold 9700

Re: Acessing data from a DataProvider

If u want to get the first item's username in the dataprovider, u can do so by doing the following:

trace("username: " + dp.getItemAt(0).username);

Good luck!
J. Rab (Blog) (Twitter)
1. If you liked my post or found it useful please click on the thumbs up and provide a Like!
2. If my post solved your problem please click on the Accept as Solution button. Much appreciated!

Approved Apps: OnTrack | ssShots | Hangman
Posts: 1,003
Registered: ‎01-16-2011
My Device: PlayBook (sim)
My Carrier: Rogers

Re: Acessing data from a DataProvider

A tip when posting code:


Click the clipboard with the letter "c" on it to paste code in a greyed out box. This will help avoid emoticons appearing in your code!

- If you like my response/post, or it helped you find an answer you were looking for, please provide a Kudo - white star to the bottom right of this post. -
- Please use the search bar at the top, or check out the PlayBook FAQ's for help getting started -
- Hockey DrillBook -
Posts: 1,269
Registered: ‎12-29-2010
My Device: PlayBook, Z10 LE, Dev Alpha C

Re: Acessing data from a DataProvider

See below image for what jffurlan is talking about.  Note that the post editor gives you tabs for "Rich Text", "HTML", and "Preview".  You want to select the "Rich Text" tab in the post editor to get the toolbar that includes the code clipboard.



New Developer
Posts: 5
Registered: ‎11-04-2010
My Device: Not Specified

Re: Acessing data from a DataProvider

Thanks for the quick and accurate response.  I knew it was going to be easy.  And thanks for the posting tips everyone else.  I didn't even realize what pasting code would parse out to.