Remove a result, print a new one in its place

Hi Betlic,

If the text is “piling up” then there’s an object reference issue, where it’s not recognizing the previous object, and thus it creates a new one. Updating the .text property on a text object should update that text, so if that’s not occurring, then you need to carefully check your references to see why it’s not updating the one you want.

Brent

I tried your code again Ziad, its working. Your right, by placing the result out of the loop by doing this,

text.text = result

Lets it update properly. Just so I understand, could you explain text.text? I know one of the texts is a variable, and I know two are needed for it to work, but am not sure how the two togehter let this work.

Still, much obliged.

Hi Betlic,

In “text.text”, the first is your variable name. That could be anything that isn’t reserved or “illegal” as regarded by Lua, i.e.

myText.text

someOtherName.text

etc.

The second (.text) is a property of that object, used by Corona, and it must be .text, because that specifies the object’s text (how that text object visually appears). Changing this property updates the text object.

Brent

Actually, this guide explains it all better:

http://docs.coronalabs.com/guide/start/helloWorld/index.html

Thanks for both of your helps.

If your still around Ziad.Ali, what if I wanted more then 1 result out of the loop? I noticed it only lets me return one result. Would it make sense to go in the direction of using * row.id inside the loop to produce more then one result? I would already have removed LIMIT 1 of course.

Wassup?

What do you mean? When “tap” happens you want to show more than one row? If so, how? In the same display.newText, concatenating the result string? Creating new texts each row?

Thats right, I would like to show more then one result. Would looking at the widget for tableview be going in the right direction?

Yes, it could be an option, i guess.

Have you watched this video?

https://www.youtube.com/watch?v=PXo4Rv5KPjo

Im not sure, Ill watch that again, thanks.