SQLite records wrapping over other records

I am working on an app with static data that is being pulled from a SQLite database.  I am running into problems with the text from a row of data overlapping the beginning text of the next row.  I think that I need to capture the Y insertion, then add the text height and a multiple of the font (e.g. fSize * 1.5).  I don’t know how to capture this correctly.  Here is the code that I have, it is being implemented on storyboard.  (I know storyboard is going away, sort of.)

local storyboard = require( “storyboard” )
local scene = storyboard.newScene()

– Called when the scene’s view does not exist:
function scene:createScene( event )
        local group = self.view

    local function onScroll(e)
    --See http://developer.anscamobile.com/reference/index/scrollview-after-build-2011715
        if(e.type == “beganScroll”) then
            --Fired at the start of the scrolling
        elseif(e.type == “endedScroll”) then
            --Fired at the end of scrolling
        elseif(e.type == “movingToTopLimit”) then
            --Fired upon hitting the top limit
        elseif(e.type == “movingToBottomLimit”) then
            --Fired upon hitting the bottom limit
        elseif(e.type == “movingToLeftLimit”) then
            --Fired upon hitting the left limit
        elseif(e.type == “movingToRightLimit”) then
            --Fired upon hitting the right limit
        end --end of If Statement
    end --end of onScroll function
    
    local scrollView = widget.newScrollView({
        top = display.statusBarHeight,
        width = display.contentWidth,
        height = display.contentHeight + tTop,
        locked = false,
        listener = onScroll,
        hideBackground = true,
        horizontalScrollDisabled = true,
        bottomPadding = fSize*8 – I think this is needed because I don’t have the scrollview
                                                – size correct below.  I think need to subtract the top,
                                                – instead of adding it.
    })

    local dataTitle = display.newText(“Data Title”, display.contentWidth/2, display.statusBarHeight*2, native.systemFont, fSize*2)
        chapterTitle.anchorX = .5
        scrollView:insert(chapterTitle)

    local count = 0
    local rowY = tTop
    local output = “data”
    local sql = “SELECT * FROM data WHERE data1 = ‘01’”
    
    for row in db:nrows(sql) do
    
        if row.proverbs == nil then
            print(" NO VERSE FOUND ")
        end --end of If Statement

        count = count +1 --does this need to be after the scrollview insert?
                --data2 contains numbers 01, 02, ect. (25 - 35 rows of data displayed)
                --data3 contains text that will, in most cases, wrap.
        local dbText = row.data2…"  "…row.data3
        local t = display.newText(dbText, tTab, tTop + ((fSize * 1.25) + (fSize * 4.5 * count)), tWidth, 0, native.systemFont, fSize)
        t:setFillColor(255,0,0)
        t.anchorX = 0
        t.anchorY = 0
        scrollView:insert(t)
    
    end --end of For loop
    
end --end of createScene

i think the problem lies where the y-position is not updated. Look at this line :

local t = display.newText(dbText, tTab, tTop + ((fSize \* 1.25) + (fSize \* 4.5 \* count)), tWidth, 0, native.systemFont, fSize)

You will need to update the y-position (which is variable “tTop”) to something like that. Do remember to initialise ‘tTop’ first, as i don’t see it in your codes.

tTop = t.y + t.contentHeight -- Top Reference

Thanks, that did the trick!  That is exactly what I was looking for.

i think the problem lies where the y-position is not updated. Look at this line :

local t = display.newText(dbText, tTab, tTop + ((fSize \* 1.25) + (fSize \* 4.5 \* count)), tWidth, 0, native.systemFont, fSize)

You will need to update the y-position (which is variable “tTop”) to something like that. Do remember to initialise ‘tTop’ first, as i don’t see it in your codes.

tTop = t.y + t.contentHeight -- Top Reference

Thanks, that did the trick!  That is exactly what I was looking for.