So, what I’m trying to do is populate a table, in this case called entity_info, with information from an SQL database. I need two values from the table in order to do this, entity_category and entity_name.
Whilst populating the table, I do something like this:
var rows = db.execute('SELECT DISTINCT entity_name FROM entity_info');
var rows2 = db.execute('SELECT entity_category FROM entity_info');
while (rows.isValidRow()) {
//herp derp herp creating a table...
var name = Ti.UI.createLabel({
text : rows.fieldByName('entity_name'),
color : '#666',
left : '50dp',
font : {
fontSize : 22,
fontWeight : 'bold',
fontFamily : 'Arial'
},
backgroundColor : '#fff'
});
var category = Ti.UI.createLabel({
text : rows2.fieldByName('entity_category'),
color : '#666',
left : '60dp',
top : '40dp',
font : {
fontSize : 13,
fontFamily : 'Arial',
fontStyle : 'italic'
}
});
rows.next();
rows2.next();
}
But, that doesn’t work for my purposes because it splits the two statements up and messes the ordering of the name to category matching. So, what I need to do is take one request (and just use the single rows variable), and then use that for the while statement and setting the text of each label.
Thanks!
Did you try combining the SQL statements in rows and rows2?
And just use rows as is.