Thanks Rob for the help, I followed a link from the sqlite tutorial and found that out. It’s my first time with sqlite but I’m getting there… slowly…
I’ve made som progress, getting the result into a tableview or scrollview was easy but my problem is how do I match the the rest of the letters?
I sort through the db words starting with the first letter of the input field string was easy but now I want to sort that result if they contain the other letters.
So in my mind I think;
Find all words starting with “first letter” --> within that result find all words containing letter 2 and 3 --> within that result, find all words where letter 2 occur before letter 3 --> sort that result by length of word --> print result/ display result.
I’ve stripped out the widget stuff etc but here’s what I got so far.
[code]
local sqlite = require(“sqlite3”)
local path = system.pathForFile(“name_list.sqlite”, system.DocumentsDirectory)
local db = sqlite3.open(path)
local first = string.sub(inputString, 0, 1)
– LIMIT is only there to because it’s just too many results atm…
local sql = “SELECT * FROM names WHERE name LIKE '”…first…"%’ LIMIT 10"
for row in db:nrows(sql) do
nameArray =
{
name = row.name,
num = string.len(row.name)
}
print( "Names: "…nameArray[“name”])
print("Count: "…nameArray[“num”])
end
[/code] [import]uid: 65840 topic_id: 35342 reply_id: 140494[/import]