# Passing Target in the ListView

**URL:** <https://forums.solar2d.com/t/passing-target-in-the-listview/304860>\
**Category:** Other\
**Created:** [July 15, 2012, 1:43am UTC](https://forums.solar2d.com/t/passing-target-in-the-listview/304860 "2012-07-15T01:43:58Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![marc81](https://forums.solar2d.com/letter_avatar_proxy/v4/letter/m/ee7513/32.png) [@marc81](https://forums.solar2d.com/u/marc81)\
**Post date:** [July 15, 2012, 1:43am UTC](https://forums.solar2d.com/t/passing-target-in-the-listview/304860/1 "2012-07-15T01:43:58Z")

</div>

Instead of posting the entire code, here’s the link of what I’m playing with:  
[http://developer.coronalabs.com/content/list-view-2](http://developer.coronalabs.com/content/list-view-2)

The listView is a great tool, and probably the most necessary part of displaying data for me.

I can see that when the List Item is touched, a new screen is transitioned, while the backBtn is transitioned into view - along with a small text message displaying which List Item was touched in the array.

Here’s the thing, I want to detect a preset ID, or Name, or Database ID (if the list item is populated from a database).

lines 34 - 49

```auto
function listButtonRelease( event )  
 self = event.target  
 local id = self.id  
 print(self.id)  
  
 detailScreenText.text = "You tapped item ".. self.id  
  
 transition.to(myList, {time=400, x=display.contentWidth\*-1, transition=easing.outExpo })  
 transition.to(detailScreen, {time=400, x=0, transition=easing.outExpo })  
 transition.to(backBtn, {time=400, x=math.floor(backBtn.width/2) + screenOffsetW\*.5 + 6, transition=easing.outExpo })  
 transition.to(backBtn, {time=400, alpha=1 })  
  
 delta, velocity = 0, 0  
end  
```

I see **print(self.id)** as the identifying feature in the touch event. And that’s the sorted number in the list.  
How do I pass my own specific ID for each List Item, so I can look up specific data from the database?

I imagine it’s possible from within the table data provided:

`  
-- setup some data  
local data = {}  
for i=1, 20 do  
 data[i] = {}  
 data[i].title = "List item ".. i  
 local c = math.modf(i/5)  
 data[i].category = "Category ".. c + 1  
end  
` [import]uid: 154122 topic\_id: 28668 reply\_id: 328668[/import]
