The row numbers from the model underlying the table view and the row number in the model created at line 11 are not necessarily related to each other. The query at line 11 can return the rows in any order. If the view sits on a table model based on "clients" then you can use that model to access the clientid.
It's also possible that column 1 (the second column) is not a numeric column, e.g. a varchar() column containing a string, that toInt() will always convert to 0.
The for() loop at line 7 ends at line 9, is that intentional? You will get only the last selected row at line 12 as it is now.
Bookmarks