newTableView:insertRow() - nil field

Hi - I’ve gone blurry-eyed on this one…

in the line of code, below – tableView:insert(options) – I am getting the error "attempt to index field ? (a nil value)

FACTS

  1. #listData does have rows.

  2. print() outputs for A-I provide correct/valid values, with TABLE outputted where appropriate

  3. print(“2”,options), the line AFTER tableView:insert(options), does NOT print

What am i missing, please?

Thanks for any input. I’ve been looking at this for 4+ hours - and cannot figure it out.

Seth

+++++++++++++++++++++++++++++++++++++++++

if #listData>0 then
        local rowHeightAssign = var.tableViewRowHeight
        local rowColorAssign = { default = { 1, 1, 1 } }
        local lineColorAssign = { 220/255, 220/255, 200/255 }
        
        for i = 1, #listData do
        
            local paramsInUse = {idx=i,listInUse=listName,PK = listData[i].PK}
            local options ={
                rowHeight = rowHeightAssign,
                rowColor = rowColorAssign,
                lineColor = lineColorAssign,
                params = paramsInUse}
            print(“A”,paramsInUse)
            print(“B”,tableView)
            print(“C”,options)
            print(“D”,rowHeightAssign)
            print(“E”,rowColorAssign)
            print(“F”,lineColorAssign)
            print(“G”,i)
            print(“H”,listName)
            print(“I”,listData[i].PK)
            tableView:insertRow(options)
            print(“2”,options)
        end
    else
        local noRecordsFound = noRecordsFound_get(segmentLabel)
        sceneGroup:insert(noRecordsFound)
    end

Can you print a larger piece of your code so that we can run it? (and please use the code format button <>)

Also, what is the full error and which line is it on?

Have you tried dumping the values of tableView out, like this:

for k,v in pairs(tableView) do print(k,v) end

What does this line print?

print("B",tableView)

Horacebury -

thanks for your input. I’m attaching a screenshot of the print(tableView) output (tt_list_tableView_printParams_20150221.PNG). The attached .PNG file also displays the full error, along with the table output.

The error occurs on Line 174 of list.lua -> tableView:insertRow(options)

FYI…you won’t be able to run this code “as is” as there are included files (via require()) that are assigned.

FYI, the purpose of this scene is to manage three lists: Project/Client, Time, and Expense. The Project/Client list has 0 records - and this runs successfully with the desired output (see screenshot file); but since it has 0 records, it does not traverse where the error occurs when there is an attempt to bring in the Expense or Time lists.

Essentially, the User clicks one of the three partitions on the newSegmentedControl at top of screen (project/client, time, expense), which invokes function = segPressed. SegPressed in turn, by virtue of the segmentLabel value, fires list_get(), which contains the tableView:insert() line - and is currently invoked when Time or Expense partitions are clicked.

I’m also attaching a screenshot of what happens when the Project/Client code runs. this is the default action when the scene (from list.lua) fires.

I’m sure it’s something stupid I’ve overlooked - this code WAS running. But in an attempt to make the code more “efficient”, I broke it.

Thanks again for any advice you might have.

here’s the list.lua file code:

-- -- Project: list.lua -- Description: Manage project, time, expense lists -- -- Version: 1.0 -- Managed with http://CoronaProjectManager.com -- -- Copyright 2015 Seth Hersh. All Rights Reserved. -- local widget = require("widget") widget.setTheme ("widget\_theme\_android") local composer = require( "composer" ) local scene = composer.newScene() local sqlite3 = require("sqlite3") local table = require("table") local display = require("display") -- include files for SQL and scenes require("tt\_scene") require("tt\_SQL") -- global vars used in TT var = require("tt\_var") -- ----------------------------------------------------------------------------------------------------------------- -- All code outside of the listener functions will only be executed ONCE unless "composer.removeScene()" is called. -- ----------------------------------------------------------------------------------------------------------------- local centerX = display.contentCenterX local centerY = display.contentCenterY local screenLeft = display.screenOriginX local screenWidth = display.viewableContentWidth - (screenLeft \* 2) local screenRight = screenLeft + screenWidth local screenTop = display.screenOriginY local screenHeight = display.viewableContentHeight - (screenTop \* 2) local screenBottom = screenTop + screenHeight local screenTopSB = screenTop + display.topStatusBarContentHeight -- when SB showing local screenHeightSB = display.viewableContentHeight - screenTopSB local screenBottomSB = screenTopSB + screenHeightSB local refPtTL = display.TopLeftReferencePoint local refPtTC = display.TopCenterReferencePoint local refPtTR = display.TopRightReferencePoint local refPtCL = display.CenterLeftReferencePoint local refPtC = display.CenterReferencePoint local refPtCR = display.CenterRightReferencePoint local refPtBL = display.BottomLeftReferencePoint local refPtrBC = display.BottomCenterReferencePoint local refPtBR = display.BottomRightReferencePoint local segControl local segControlTab local sceneTitle = "Manage Lists" local queryListRecordsBase = "select \* from " local databaseName = "timeTracker.sqlite" local listData ={} local navTabBar = nil local cnt local sceneGroup = nil local tableView = nil local listData={} -- open db local path = system.pathForFile( databaseName, system.DocumentsDirectory ) local db = sqlite3.open( path ) local function list\_get(segmentLabel) local idx = 0 local thisRow local listName -- remove all records in listDta tableView:deleteAllRows() listData = {} local function noRecordsFound\_get(listName) local rowTitle = display.newText(sceneGroup,"No " .. listName .. " records found." , 0, 0, "Helvetica", 16 ) rowTitle.x = tableView.x rowTitle.y = tableView.y rowTitle:setFillColor(1, 1, 1) return rowTitle end -- populate the tableView widget with data -- get the list of Projects from database if segmentLabel == "Project/Client" then listName = "project" queryRecords = queryListRecordsBase .. listName .. " order by descrip" -- how many records cnt = query\_getRowCnt(db,queryRecords) if cnt \> 0 then for row in db:nrows(queryRecords) do thisRow = { --PK\_project=row.PK\_project, PK=row.PK\_project, descrip=row.descrip, active=row.active, ratePerHr=row.ratePerHr } table.insert(listData,thisRow) end end elseif segmentLabel == "Time" then listName = "category" queryRecords = queryListRecordsBase .. listName .. " order by descrip" -- how many records cnt = query\_getRowCnt(db,queryRecords) if cnt \> 0 then for row in db:nrows(queryRecords) do thisRow= { --PK\_category=row.PK\_category, PK = row.PK\_category, descrip=row.descrip, active=row.active, defaultCategory=row.defaultCategory } table.insert(listData,thisRow) end end elseif segmentLabel == "Expense" then listName = "expense" queryRecords = queryListRecordsBase .. listName .." order by descrip" -- how many records cnt = query\_getRowCnt(db,queryRecords) if cnt \> 0 then for row in db:nrows(queryRecords) do thisRow= { --PK\_expense=row.PK\_expense, PK = row.PK\_expense, descrip=row.descrip, active=row.active } table.insert(listData,thisRow) end end end -- populate array = listData if #listData\>0 then local rowHeightAssign = var.tableViewRowHeight local rowColorAssign = { default = { 1, 1, 1 } } local lineColorAssign = { 220/255, 220/255, 200/255 } for i = 1, #listData do local paramsInUse = {idx=i,listInUse=listName,PK = listData[i].PK} local options ={ rowHeight = rowHeightAssign, rowColor = rowColorAssign, lineColor = lineColorAssign, params = paramsInUse} for k,v in pairs(tableView) do print("tableView(key,value):",k,v) end --[[print("A",paramsInUse) print("B",tableView) print("C",options) print("D",rowHeightAssign) print("E",rowColorAssign) print("F",lineColorAssign) print("G",i) print("H",listName) print("I",listData[i].PK) --]] tableView:insertRow(options) print("2",options) end else local noRecordsFound = noRecordsFound\_get(segmentLabel) sceneGroup:insert(noRecordsFound) end end -- Listen for segmented control events local function segPressed( event ) local target = event.target list\_get(target.segmentLabel) return true end local function renderRow(event) local row = event.row local dataToDisplay local listInUse = row.params.listInUse -- optional variables for easier placement local rowWidth = row.contentWidth local rowHeight = row.contentHeight local rowCenterX = rowWidth/2 local rowCenterY = rowHeight/2 local rowLeft = 0 local rowRight = rowLeft + rowWidth local rowTop = 0 local rowBottom = rowTop + rowHeight idx = row.params.idx -- remove all records in listDta tableView:deleteAllRows() --listData = {} if #listData \> 0 then dataToDisplay = listData[idx]["descrip"] local rowTitle = display.newText( row,dataToDisplay , 0, 0, "Helvetica", 16 ) rowTitle.anchorX = 0 rowTitle.x = rowLeft + 15 rowTitle.y = rowCenterY rowTitle:setFillColor(0, 14/255, 164/255) --end --local rowTitle = display.newText( row,dataToDisplay , 0, 0, "Helvetica", 16 ) --rowTitle.anchorX = 0 --rowTitle.x = rowLeft + 15 --rowTitle.y = rowCenterY --rowTitle:setFillColor(0, 14/255, 164/255) --[ -- make a delete button -- check if the cnt is actully 0 --if #listData \> 0 then local deleteBtn = display.newImage(row,"images/deleteBtn.png",rowRight - 22,rowTop+rowHeight/2) function deleteBtn:touch(event) if event.phase == "ended" then --table.remove(nameData,idx) -- view data in array tableView:deleteRow(deleteBtn.id) -- delete from db if listInUse == "expense" then expense\_delete(db,row.params.PK) elseif listInUse == "category" then category\_delete(db,row.params.PK) elseif listInUse == "project" then print("list:rowRender",listInUse) end end return true end deleteBtn.idx = row.params.idx deleteBtn:addEventListener( "touch", deleteBtn ) deleteBtn.id = row.index row.deleteBtn = deleteBtn end end local function rowTouched(event) print("list:rowTouched",event.row.id) end local function setupDisplay (grp) local btnSettings ={} local bgOptions = {} local txtOptions = {} local btnOptions = {} local bg = display.newImage( grp,var.bgImagePathname ) grp:insert(bg) -- lay down the Header, eg, Time Tracker local txtHeader = sceneHeader\_get(grp) grp:insert(txtHeader) -- lay down the scene name, eg, Main Menu local txtSceneTitle = sceneTitle\_get(sceneTitle,grp,txtHeader) grp:insert(txtSceneTitle) -- Create a segmented control local partitions = {"Project/Client","Time","Expense"} --segControl = segControlTopMenu (partitions,centerX,txtSceneTitle.y + txtSceneTitle.height/2 + var.yTopBtn) local segControl = widget.newSegmentedControl({ segments = partitions, labelFont = native.systemFont, labelSize = 14, segmentWidth = screenWidth/#partitions, emboss = true, onPress = segPressed, selected = false }) segControl.x = centerX segControl.y = txtSceneTitle.y + txtSceneTitle.height/2 + var.yTopBtn grp:insert(segControl) -- descrip set above segControl local sceneDescrip = sceneDescrip\_get("Manage Lists critical to " .. var.appHeader .. ".",grp,segControl.x,segControl.y) grp:insert(sceneDescrip) -- Create the tableView widget tableView = widget.newTableView { left = screenLeft + var.tableViewWidthAdjustment/2, top = segControl.y+segControl.height/2 + var.yTopBtn, width = screenWidth - var.tableViewWidthAdjustment, height =var.tableViewHeight, onRowRender = renderRow, onRowTouch = rowTouched, hideBackground = true, isLocked = false } grp:insert(tableView) navTabBar = navTabBar\_get() grp:insert(navTabBar) local tableViewTop = tableView.top list\_get("Project/Client") -- set the segControl to Project/Client --segControl:setActiveSegment( 1 ) --tableView.top = tableViewTop end -- "scene:create()" function scene:create( event ) sceneGroup = self.view setupDisplay(sceneGroup) --for this file, set navBar --navTabBar:setSelected(4) navTabBar:setSelected( 4, false ) end -- "scene:show()" function scene:show( event ) local sceneGroup = self.view local phase = event.phase if ( phase == "will" ) then -- Called when the scene is still off screen (but is about to come on screen). elseif ( phase == "did" ) then -- Called when the scene is now on screen. -- Insert code here to make the scene come alive. -- Example: start timers, begin animation, play audio, etc. end end -- "scene:hide()" function scene:hide( event ) local sceneGroup = self.view local phase = event.phase if ( phase == "will" ) then -- Called when the scene is on screen (but is about to go off screen). -- Insert code here to "pause" the scene. -- Example: stop timers, stop animation, stop audio, etc. elseif ( phase == "did" ) then -- Called immediately after scene goes off screen. end end -- "scene:destroy()" function scene:destroy( event ) local sceneGroup = self.view -- Called prior to the removal of scene's view ("sceneGroup"). -- Insert code here to clean up the scene. -- Example: remove display objects, save state, etc. end -- ------------------------------------------------------------------------------- -- Listener setup scene:addEventListener( "create", scene ) scene:addEventListener( "show", scene ) scene:addEventListener( "hide", scene ) scene:addEventListener( "destroy", scene ) -- ------------------------------------------------------------------------------- return scene

horacebury -

do u think this might be related to the fact that when the scene runs INITIALLY it goes through setupDisplay() and creates object=tableView for default = Project/Client. this always happen.

then when I click on the Expense or Time option, this causes a conflict with the initially created tableView object made for Projoect/Client?

I’m NOT familiar with memory management issues in Corona

Seth

horacebury -

please don’t pursue this anymore. it’s poorly implemented in that I shouldn’t try to cram three processes into one.

i’ve broken the code apart and simply creating new scenes for each specific task. and it is working fine on a specific-scene basis. i’ll implement the objects into a function to provide consistency screen-to-screen - and all will be right with the world.

i kinda feel the three-in-one approach caused a memory-related issue with the repeated calls.

Can you print a larger piece of your code so that we can run it? (and please use the code format button <>)

Also, what is the full error and which line is it on?

Have you tried dumping the values of tableView out, like this:

for k,v in pairs(tableView) do print(k,v) end

What does this line print?

print("B",tableView)

Horacebury -

thanks for your input. I’m attaching a screenshot of the print(tableView) output (tt_list_tableView_printParams_20150221.PNG). The attached .PNG file also displays the full error, along with the table output.

The error occurs on Line 174 of list.lua -> tableView:insertRow(options)

FYI…you won’t be able to run this code “as is” as there are included files (via require()) that are assigned.

FYI, the purpose of this scene is to manage three lists: Project/Client, Time, and Expense. The Project/Client list has 0 records - and this runs successfully with the desired output (see screenshot file); but since it has 0 records, it does not traverse where the error occurs when there is an attempt to bring in the Expense or Time lists.

Essentially, the User clicks one of the three partitions on the newSegmentedControl at top of screen (project/client, time, expense), which invokes function = segPressed. SegPressed in turn, by virtue of the segmentLabel value, fires list_get(), which contains the tableView:insert() line - and is currently invoked when Time or Expense partitions are clicked.

I’m also attaching a screenshot of what happens when the Project/Client code runs. this is the default action when the scene (from list.lua) fires.

I’m sure it’s something stupid I’ve overlooked - this code WAS running. But in an attempt to make the code more “efficient”, I broke it.

Thanks again for any advice you might have.

here’s the list.lua file code:

-- -- Project: list.lua -- Description: Manage project, time, expense lists -- -- Version: 1.0 -- Managed with http://CoronaProjectManager.com -- -- Copyright 2015 Seth Hersh. All Rights Reserved. -- local widget = require("widget") widget.setTheme ("widget\_theme\_android") local composer = require( "composer" ) local scene = composer.newScene() local sqlite3 = require("sqlite3") local table = require("table") local display = require("display") -- include files for SQL and scenes require("tt\_scene") require("tt\_SQL") -- global vars used in TT var = require("tt\_var") -- ----------------------------------------------------------------------------------------------------------------- -- All code outside of the listener functions will only be executed ONCE unless "composer.removeScene()" is called. -- ----------------------------------------------------------------------------------------------------------------- local centerX = display.contentCenterX local centerY = display.contentCenterY local screenLeft = display.screenOriginX local screenWidth = display.viewableContentWidth - (screenLeft \* 2) local screenRight = screenLeft + screenWidth local screenTop = display.screenOriginY local screenHeight = display.viewableContentHeight - (screenTop \* 2) local screenBottom = screenTop + screenHeight local screenTopSB = screenTop + display.topStatusBarContentHeight -- when SB showing local screenHeightSB = display.viewableContentHeight - screenTopSB local screenBottomSB = screenTopSB + screenHeightSB local refPtTL = display.TopLeftReferencePoint local refPtTC = display.TopCenterReferencePoint local refPtTR = display.TopRightReferencePoint local refPtCL = display.CenterLeftReferencePoint local refPtC = display.CenterReferencePoint local refPtCR = display.CenterRightReferencePoint local refPtBL = display.BottomLeftReferencePoint local refPtrBC = display.BottomCenterReferencePoint local refPtBR = display.BottomRightReferencePoint local segControl local segControlTab local sceneTitle = "Manage Lists" local queryListRecordsBase = "select \* from " local databaseName = "timeTracker.sqlite" local listData ={} local navTabBar = nil local cnt local sceneGroup = nil local tableView = nil local listData={} -- open db local path = system.pathForFile( databaseName, system.DocumentsDirectory ) local db = sqlite3.open( path ) local function list\_get(segmentLabel) local idx = 0 local thisRow local listName -- remove all records in listDta tableView:deleteAllRows() listData = {} local function noRecordsFound\_get(listName) local rowTitle = display.newText(sceneGroup,"No " .. listName .. " records found." , 0, 0, "Helvetica", 16 ) rowTitle.x = tableView.x rowTitle.y = tableView.y rowTitle:setFillColor(1, 1, 1) return rowTitle end -- populate the tableView widget with data -- get the list of Projects from database if segmentLabel == "Project/Client" then listName = "project" queryRecords = queryListRecordsBase .. listName .. " order by descrip" -- how many records cnt = query\_getRowCnt(db,queryRecords) if cnt \> 0 then for row in db:nrows(queryRecords) do thisRow = { --PK\_project=row.PK\_project, PK=row.PK\_project, descrip=row.descrip, active=row.active, ratePerHr=row.ratePerHr } table.insert(listData,thisRow) end end elseif segmentLabel == "Time" then listName = "category" queryRecords = queryListRecordsBase .. listName .. " order by descrip" -- how many records cnt = query\_getRowCnt(db,queryRecords) if cnt \> 0 then for row in db:nrows(queryRecords) do thisRow= { --PK\_category=row.PK\_category, PK = row.PK\_category, descrip=row.descrip, active=row.active, defaultCategory=row.defaultCategory } table.insert(listData,thisRow) end end elseif segmentLabel == "Expense" then listName = "expense" queryRecords = queryListRecordsBase .. listName .." order by descrip" -- how many records cnt = query\_getRowCnt(db,queryRecords) if cnt \> 0 then for row in db:nrows(queryRecords) do thisRow= { --PK\_expense=row.PK\_expense, PK = row.PK\_expense, descrip=row.descrip, active=row.active } table.insert(listData,thisRow) end end end -- populate array = listData if #listData\>0 then local rowHeightAssign = var.tableViewRowHeight local rowColorAssign = { default = { 1, 1, 1 } } local lineColorAssign = { 220/255, 220/255, 200/255 } for i = 1, #listData do local paramsInUse = {idx=i,listInUse=listName,PK = listData[i].PK} local options ={ rowHeight = rowHeightAssign, rowColor = rowColorAssign, lineColor = lineColorAssign, params = paramsInUse} for k,v in pairs(tableView) do print("tableView(key,value):",k,v) end --[[print("A",paramsInUse) print("B",tableView) print("C",options) print("D",rowHeightAssign) print("E",rowColorAssign) print("F",lineColorAssign) print("G",i) print("H",listName) print("I",listData[i].PK) --]] tableView:insertRow(options) print("2",options) end else local noRecordsFound = noRecordsFound\_get(segmentLabel) sceneGroup:insert(noRecordsFound) end end -- Listen for segmented control events local function segPressed( event ) local target = event.target list\_get(target.segmentLabel) return true end local function renderRow(event) local row = event.row local dataToDisplay local listInUse = row.params.listInUse -- optional variables for easier placement local rowWidth = row.contentWidth local rowHeight = row.contentHeight local rowCenterX = rowWidth/2 local rowCenterY = rowHeight/2 local rowLeft = 0 local rowRight = rowLeft + rowWidth local rowTop = 0 local rowBottom = rowTop + rowHeight idx = row.params.idx -- remove all records in listDta tableView:deleteAllRows() --listData = {} if #listData \> 0 then dataToDisplay = listData[idx]["descrip"] local rowTitle = display.newText( row,dataToDisplay , 0, 0, "Helvetica", 16 ) rowTitle.anchorX = 0 rowTitle.x = rowLeft + 15 rowTitle.y = rowCenterY rowTitle:setFillColor(0, 14/255, 164/255) --end --local rowTitle = display.newText( row,dataToDisplay , 0, 0, "Helvetica", 16 ) --rowTitle.anchorX = 0 --rowTitle.x = rowLeft + 15 --rowTitle.y = rowCenterY --rowTitle:setFillColor(0, 14/255, 164/255) --[ -- make a delete button -- check if the cnt is actully 0 --if #listData \> 0 then local deleteBtn = display.newImage(row,"images/deleteBtn.png",rowRight - 22,rowTop+rowHeight/2) function deleteBtn:touch(event) if event.phase == "ended" then --table.remove(nameData,idx) -- view data in array tableView:deleteRow(deleteBtn.id) -- delete from db if listInUse == "expense" then expense\_delete(db,row.params.PK) elseif listInUse == "category" then category\_delete(db,row.params.PK) elseif listInUse == "project" then print("list:rowRender",listInUse) end end return true end deleteBtn.idx = row.params.idx deleteBtn:addEventListener( "touch", deleteBtn ) deleteBtn.id = row.index row.deleteBtn = deleteBtn end end local function rowTouched(event) print("list:rowTouched",event.row.id) end local function setupDisplay (grp) local btnSettings ={} local bgOptions = {} local txtOptions = {} local btnOptions = {} local bg = display.newImage( grp,var.bgImagePathname ) grp:insert(bg) -- lay down the Header, eg, Time Tracker local txtHeader = sceneHeader\_get(grp) grp:insert(txtHeader) -- lay down the scene name, eg, Main Menu local txtSceneTitle = sceneTitle\_get(sceneTitle,grp,txtHeader) grp:insert(txtSceneTitle) -- Create a segmented control local partitions = {"Project/Client","Time","Expense"} --segControl = segControlTopMenu (partitions,centerX,txtSceneTitle.y + txtSceneTitle.height/2 + var.yTopBtn) local segControl = widget.newSegmentedControl({ segments = partitions, labelFont = native.systemFont, labelSize = 14, segmentWidth = screenWidth/#partitions, emboss = true, onPress = segPressed, selected = false }) segControl.x = centerX segControl.y = txtSceneTitle.y + txtSceneTitle.height/2 + var.yTopBtn grp:insert(segControl) -- descrip set above segControl local sceneDescrip = sceneDescrip\_get("Manage Lists critical to " .. var.appHeader .. ".",grp,segControl.x,segControl.y) grp:insert(sceneDescrip) -- Create the tableView widget tableView = widget.newTableView { left = screenLeft + var.tableViewWidthAdjustment/2, top = segControl.y+segControl.height/2 + var.yTopBtn, width = screenWidth - var.tableViewWidthAdjustment, height =var.tableViewHeight, onRowRender = renderRow, onRowTouch = rowTouched, hideBackground = true, isLocked = false } grp:insert(tableView) navTabBar = navTabBar\_get() grp:insert(navTabBar) local tableViewTop = tableView.top list\_get("Project/Client") -- set the segControl to Project/Client --segControl:setActiveSegment( 1 ) --tableView.top = tableViewTop end -- "scene:create()" function scene:create( event ) sceneGroup = self.view setupDisplay(sceneGroup) --for this file, set navBar --navTabBar:setSelected(4) navTabBar:setSelected( 4, false ) end -- "scene:show()" function scene:show( event ) local sceneGroup = self.view local phase = event.phase if ( phase == "will" ) then -- Called when the scene is still off screen (but is about to come on screen). elseif ( phase == "did" ) then -- Called when the scene is now on screen. -- Insert code here to make the scene come alive. -- Example: start timers, begin animation, play audio, etc. end end -- "scene:hide()" function scene:hide( event ) local sceneGroup = self.view local phase = event.phase if ( phase == "will" ) then -- Called when the scene is on screen (but is about to go off screen). -- Insert code here to "pause" the scene. -- Example: stop timers, stop animation, stop audio, etc. elseif ( phase == "did" ) then -- Called immediately after scene goes off screen. end end -- "scene:destroy()" function scene:destroy( event ) local sceneGroup = self.view -- Called prior to the removal of scene's view ("sceneGroup"). -- Insert code here to clean up the scene. -- Example: remove display objects, save state, etc. end -- ------------------------------------------------------------------------------- -- Listener setup scene:addEventListener( "create", scene ) scene:addEventListener( "show", scene ) scene:addEventListener( "hide", scene ) scene:addEventListener( "destroy", scene ) -- ------------------------------------------------------------------------------- return scene

horacebury -

do u think this might be related to the fact that when the scene runs INITIALLY it goes through setupDisplay() and creates object=tableView for default = Project/Client. this always happen.

then when I click on the Expense or Time option, this causes a conflict with the initially created tableView object made for Projoect/Client?

I’m NOT familiar with memory management issues in Corona

Seth

horacebury -

please don’t pursue this anymore. it’s poorly implemented in that I shouldn’t try to cram three processes into one.

i’ve broken the code apart and simply creating new scenes for each specific task. and it is working fine on a specific-scene basis. i’ll implement the objects into a function to provide consistency screen-to-screen - and all will be right with the world.

i kinda feel the three-in-one approach caused a memory-related issue with the repeated calls.