ID assigned to iOSTable click

Hi. I want to use a unique ID as part of a SQL statement on a following view based on the specific cell the user pushes in the table. I’ve used the following for a similar use on another table but I do not want to show the ID on the table

Using this on another table

dim oCell as iOSTableCellData = me.RowData(section, row) SetName = oCell.Text

I thought using Tag, but this doesn’t seem to work, such as ID = oCell.Tag.

Any suggestions?

It should work.

In the table open event I add this:

[code] dim iSection as Integer = me.AddSection( “Targets”)

dim oRow as iOSTableCellData

oRow = new iOSTableCellData
oRow.Text = “Macintosh”
oRow.DetailText = “Apple”
oRow.Image = picMac
oRow.AccessoryType = iOSTableCellData.AccessoryTypes.Checkmark
oRow.Tag = 1
me.AddRow iSection, oRow[/code]

In the table Action event I have this:

dim i as integer dim oCell as iOSTableCellData = me.RowData(section, row) i = oCell.Tag

I have verified that this works (at least in the simulator).

Are you sure you’re actually putting something in the RowTag? Since it’s an Auto you’ll need to verify that it contains something. If you want to find out what’s in an Auto variable you can do something like the following:

[code]Function FindType(extends au as Auto) As Text
dim oTypeInfo as xojo.Introspection.TypeInfo = Xojo.Introspection.GetType(au)

return oTypeInfo.FullName
End Function
[/code]

The action event would then be something like:

dim i as integer dim oCell as iOSTableCellData = me.RowData(section, row) if oCell.Tag.FindType = "Int32" then i = oCell.Tag else //not an integer! Do something different. end

Thanks Bob. I kind of get it. Here is my process:

table on view 1. “Loading” the cellData.tag from a db table

[code] cellData = New iOSTableCellData
cellData.Text = rs.Field(“ProgTest”).TextValue

    'tags the cell with ProgID
    cellData.Tag = rs.Field("ProgID").IntegerValue
    
    'add rows
    TestResultsTable.AddRow(0, cellData)
    [/code]

then on table action in view 1

[code] dim newProgID as Integer
newProgID = oCell.Tag

ReDim incorrArray(-1)
dim sql as Text

sql = “SELECT IncorID from incorrect WHERE ProgID = '” + newProgID.ToText + “’”

dim rs as SQLiteRecordSet = App.dbUser.SQLSelect(sql)

While not rs.EOF
incorrArray.Append(rs.Field(“IncorID”).IntegerValue)
rs.MoveNext
Wend[/code]

then on view 2 open

[code]Dim ReviewProgID as Integer
Dim intMoveIncorr as integer = 0
ReviewProgID = incorrArray(intMoveIncorr)

dim sql as Text = "SELECT * FROM incorrect WHERE IncorID = " + ReviewProgID.ToText[/code]

I’m getting an OutOfBounds exception on
ReviewProgID = incorrArray(intMoveIncorr)

Got it figured out. Discovered an error elsewhere. Thanks again for your help Bob!