Hi Folks,
this is the code from DatabaseHelper:
public String getCityName(int cityId) {
Object cityItemId = cityContainer.getIdByIndex(cityId); // <- confuses index and city.id
return cityContainer.getItem(cityItemId).getItemProperty("name")
.getValue().toString();
}
the line : “Object cityItemId = cityContainer.getIdByIndex(cityId);”
retrieves the city name from the index of the table not the cityid (integer) - in other words if you have a table that has some cities deleted and the index no longer has a one to one and onto relationship with the city.id, and hence the city.name.
example table:
idx id name
0 0 Denver
1 1 Colorado Springs
3 5 Aurora
4 9 New York
5 10 Tampa
2 resulting bugs;
-
When retrieving a city.name that occurs after the city that was deleted you will not longer get the city you wanted. – eg. pass in id 5 and it will return Tampa! not Aurora.
-
If the city.id you are trying to retrieve is greater than the number of lines in the table (+1) you will get a limited number of lines showing in your web table. --eg. pass in 9 and it falls over syntax error missing ] element ] after element list stack.
please help…how do I fix this please?