How to add multiple data to rows?

Hello,

I am using the code below to add data to a row. This works fine for submitting one record in JSON to my server. Now I need to loop through my SQLite table in the app and add multiple records. Can someone show me how to do this?

Here is where I loop through the table in SQLite and get the data I need to post with.

 local path = system.pathForFile("timecard.db", system.DocumentsDirectory) db = sqlite3.open( path ) for row in db:nrows("SELECT carddate, cardtime, location, activity1, activity2 FROM carddata WHERE pending = 'Y' ORDER BY carddate") do print( row.carddate ) local carddate2 = row.carddate local cardtime2 = row.cardtime local location2 = row.location local activity21 = row.activity1 local activity22 = row.activity2 end

And below is where I am creating one row to submit. I want to put this in the FOR loop and add each record so when the loop is done all the matching records are in there and I can post that JSON to my server.

 local username3 = composer.getVariable( "username" ) local foo = {} foo.timecard = { {EmpNo=EmpNo2, CardDate=carddate2, CardTime=cardtime2, Location=location2, Activity1=activity21, Activity2=activity22} } local encode = json.encode (foo) local params = {} params.body = encode network.request( "http://www.domain.com/timecardin.aspx", "POST", networkTimecardInListener, params)

This is like a table within a table I need to do and cannot figure out how to do it.

Thanks,

Warren

Hi, you must use the grid.lua. tape on google “grid.lua github steven nuclear sandwich” it’s a grid lib

Hi, you must use the grid.lua. tape on google “grid.lua github steven nuclear sandwich” it’s a grid lib