Hi,
I hope I’m not asking too many questions here on this forum. Its seems like it’s a question a day and I don’t want to be annoying. I really appreciate all the help you folks have given me.
I have a feature in my app where the user can get random records from a SQLite database from multiple topics. Its kind of hard to explain but here is an example. If you have a cookbook with recipes all stored in specific chapters like, Beef, Chicken, Desserts, Pasta, etc… and you want to pick certain chapters and return a user-defined number of random recipes from the chosen chapters and load them into a recordset. In my desktop app I have 2 ListBoxes. The user moves Chapter names from Listbox1 to Listbox2. The user will also enter the number of records to be returned in the recordset and that integer value is entered in txtNum TextField.
In my regular desktop app, I use the following code:
[code] // List all of the chapters that we want to select in an array.
dim i as Integer
dim chapters(-1) as string
dim sql as string
Dim TestNum As Integer //This is the integer for the number of recipes the query will return from the user-define txtNum.Test TextField
TestNum =Val(txtNum.Text)
for i = 0 to ListBox2.listCount - 1
chapters.append uppercase(EscapeSQLData( Trim(ListBox2.cell( i, 0 ) )))
next
// Build the SQL command.
sql = “select * from recipes where UPPER(chapter) in (’”+ join( chapters, “’,’” ) +"’)"+ "order by random() limit "+ str(TestNum)[/code]
That works great. But, in my iOS version I’m having a hard time transferring this code into the iOS framework. I have two Tables. The user selects the chapters from Table1 and they are loaded into Table2. The user then enters the number of recipes in the txtNum TextField. So I want the code to create a recordset from the recipe chapters listed in Table2.
This is the code I am working with:
[code] // List all of the chapters that we want to select in an array.
dim i as Integer
dim chapters(-1) as Text
dim sql as Text
Table2.AddSection("")
dim cell as iOSTableCellData
Dim TestNum As Integer
TestNum=Integer.FromText(txtNum.Text)
for i = 0 to Table2.RowCount(0)
chapters.append uppercase(EscapeSQLData( Trim(Table2.cell i, 0 ) )))
next
// Build the SQL command.
sql = “select * from recipes where UPPER(chapter) in (’”+ join( chapters, “’,’” ) +"’)"+ "order by random() limit "+ str(TestNum)[/code]
When I run the code it throws an error stating that iOSTable has no member named “cell” I thought I defined “cell” above.
Can anyone see what may be going on? This is kind of an important feature in my app and I would really appreciate any help.