Android Question Question about ListView and Value

parijs

Active Member
Licensed User
Longtime User
I extract items from one dbase and store some in another dbase
The Value is always the first label and it can happen that 2 are the same, so if I delete one, the other one goes with it because they have the same name.
The Second label is never the same, but how do I get hold of it?
 

Brian Dean

Well-Known Member
Licensed User
Longtime User
The title of your post mentions ListView, but the content does not; it mentions dbases, by which I assume you mean databases. Are you trying to move items between listviews or records between databases? Some sample code might help your explanation of your problem.

If you are using databases then some terminology might also help. A database contains tables; tables contain records; records contain fields; fields contain values. The sentence "The Value is always the first label and it can happen that 2 are the same, so if I delete one, the other one goes with it because they have the same name." is difficult to understand. But maybe you are talking about labels in a listview, not databases at all.
 
Upvote 0

parijs

Active Member
Licensed User
Longtime User
I'm talking about SQL one SQL contains 740 museum none with the same name.
The user wants to save the museum after visiting it in an SQL “seen” including day, but it also happens that the museum is visited 3 times, which means that the museum name appears 3 times in “seen” but the day is not the same
 
Upvote 0

emexes

Expert
Licensed User
The user wants to save the museum after visiting it in an SQL “seen” including day, but it also happens that the museum is visited 3 times, which means that the museum name appears 3 times in “seen” but the day is not the same

To clarify:

you have an SQL table called "seen" which has at least the two fields (columns):

1/ museum name
2/ day (date) visited

and you wish to select and delete some records (rows) from this table?
 
Upvote 0

parijs

Active Member
Licensed User
Longtime User
Yes but pressing the Listview only gives me the "name" if I can also catch the "date" then it will work
 
Upvote 0

Brian Dean

Well-Known Member
Licensed User
Longtime User
I think that you are still not thinking out this problem in the proper way. Your first post speaks of "extract items from one dbase and store in some other dbase." That does not sound right.

What I would expect is a a database containing one table where each record represents a museum, and a second table where each record represents a museum visit. Records in this second table contain a museum identifer and a visit date. When your user selects a museum name from the listview then you run a query on the "visits" table which returns all the dates (or none) on which that museum was visited.

If this is still not clear then I could produce an example for you, but that will take me a bit more time.
 
Upvote 0

mangojack

Well-Known Member
Licensed User
Longtime User
Yes but pressing the Listview only gives me the "name" if I can also catch the "date" then it will work

Another alternative is populate a map with the database ID, Date etc for each entry and pass that as the returned click value.

When a user clicks the list , you can get the relevant data from the map and delete the correct entry.
 
Upvote 0

MrKim

Well-Known Member
Licensed User
Longtime User
You need a scheme to make the value unique. You could make the value the name & the date for example, Or, if it is coming from the Database use the unique id of the row for the value and then look up the record again using the id. Or create a map as mentioned. There are a lot of ways to skin this cat but you must have a unique id on each item in your list.
 
Upvote 0
Top