How to evaluate value of the variable
Hi there,
I'm running SQL query against a table in SQLite table. I'm passing the results object to a function to display the table. But I'm getting error
Uncaught TypeError: undefined is not a function where I use row.eval(strItemName) in my code below.
E.g. strItemName is holding the name of column of a table - bikes. so I want row.bikes but I don't know how to do this.
Thanks for your help and time.
Joe Green
- function displayDrugCIGN ( transaction, results ) {
var listCIGN = $( '#cign_data' );
listCIGN.empty();
// Check to see if we have any results.
if (results.rows.length === 0){
$ ( '#cign' ).hide();
return;
} else {
$ ( '#cign' ).show();
}
//console.log('storeObject.strItem: ' + storeObject.strItem);
var strItemName = storeObject.strItem;
for(index=0;index<results.rows.length;index++)
{
var row = results.rows.item(index);
// Append the list item.
listCIGN.append("<p>week1: " + row.day1 + " Number of Items: " + row.number_items + " " + strItemName + ": " + row.eval(strItemName) + "</p>");
};
}