How do I correctly use tableview with a storyboard?

Hi,

Sorry for the overly large post, I feel like this is a bit of a rookie question, but Ill ask anyway. 

I am working on a new app that will rely heavily on storyboard and tableviews.  Here is an example; I have a scene that displays search categories, when one of these categories is pressed it will go to a new scene that displays criteria within that category, once the user has selected their criteria (they can select multiple criteria (will probably use a scrollview for this)) they will go back to the search category scene - this will have been updated to reflect the chosen criteria.

I thought about placing the tableview (for the category page) in either the willEnterScene or enterScene function because this way the tableview would be generated new each time the scene is entered and display the new information.  This would work correctly,  but this seems to create a massive memory leak.

In the past I would have placed it in the createScene function and purged the scene when a new scene is loaded.  This works fine, but (and maybe I am wrong) that this is bad practice and kind of goes against the whole point of having createScene, enterScene etc.

[lua]

    local lastScene = storyboard.getPrevious()

    if(lastScene) then 

        storyboard.purgeScene( lastScene )

    end

[/lua]

I tried making the tableview variable local to the whole scene, creating it in the enterScene (in the base level) and removing it and nil-ing it out in the exitScene.  This works sometime, but I sometimes get the following error “Attempt to index upvalue ‘tableView’ (a nil value)”, the same error occurs if I make it global.

What is the best way to move forward?

Thanks in advance for your help.

Craig