How to fill List from sql db

Hello, i have following code:

local function onRowRender( event ) local row = event.row local rowTitle = display.newText( row, "??Row1 Value??(dogname)", 0, 0, native.systemFontBold, 18 ) rowTitle.x = row.x - ( row.contentWidth \* 0.5 ) + ( rowTitle.contentWidth \* 0.5 ) + 10 rowTitle.y = row.contentHeight \* 0.5 rowTitle:setTextColor( 0, 0, 0 )

 for row in db:nrows("SELECT \* FROM dogs") do list:insertRow{ height = 72, } end

How can i change the text of each row to the value of the name of my dog rows?

Hi @Danwu,

In recent daily builds (for Pro users), there is a “params” table that you can pass from the insert function that contains whatever params you wish to “render” in the row (a string value, a number, whatever). This feature will, of course, be included in the next public build (for Starter users) which is coming soon.

If you can’t wait until then, I can show you how to accomplish this another way… it’s not the most “clean”, but it works. I would suggest, however, that you wait for the next public release if possible, so you can use the official params passing method.

Best regards,

Brent Sorrentino

Do you have a date for the new release?

What would the other way be?

What you need to do is to put your sql statement in a separate function and place your sql results in a table. You then call insertRow as you do now. In the onRowRender() function you simply pull each row using yourSQLResultsTable[rowNumberCounter] approach.

Hi @Danwu,

In recent daily builds (for Pro users), there is a “params” table that you can pass from the insert function that contains whatever params you wish to “render” in the row (a string value, a number, whatever). This feature will, of course, be included in the next public build (for Starter users) which is coming soon.

If you can’t wait until then, I can show you how to accomplish this another way… it’s not the most “clean”, but it works. I would suggest, however, that you wait for the next public release if possible, so you can use the official params passing method.

Best regards,

Brent Sorrentino

Do you have a date for the new release?

What would the other way be?

What you need to do is to put your sql statement in a separate function and place your sql results in a table. You then call insertRow as you do now. In the onRowRender() function you simply pull each row using yourSQLResultsTable[rowNumberCounter] approach.