[vtkusers] Problem with vtkTable and vtkVariantArray

Roger Blum rogerblum at hawaii.rr.com
Tue Mar 31 05:08:43 EDT 2009

Hi everybody,

I have just updated my old Vtk 4.4 installation to the latest 5.4.
I am working on refactoring some legacy Tcl code which includes
replacing the existing ODBC database interface with vtkSQLDatabase
and related stuff.

As a lot of the functions expect the database result sets to be
nested Tcl lists, I have written a function which transforms
a vtkRowQuery to Tcl lists:

proc vtkRowQuery2TclList {qry} {
    set trafo [vtkRowQueryToTable trafo]
    $trafo SetQuery $qry
    $trafo Update
    set table [$trafo GetOutput]; # vtkTable instance
    set result [list ]
    for {set i 0} {$i < [$table GetNumberOfRows]} {incr i} {
        set row [list ]
        for {set j 0} {$j < [$table GetNumberOfColumns]} {incr j} {
            lappend row [$table GetValue $i $j]
        lappend result $row
    $trafo Delete
    return result

When the function is executed, I get the following error message:

Object named: vtkTemp2, could not find requested method: GetValue
or the method was called with incorrect arguments.

    while executing "$table GetValue $i $j"

I have also tried to get the results by row (vtkVariantArray) and use
GetValue $j
on the row with a similar error message.

My questions:
- Is there an easier way to extract the data from the vtkRowQuery
- Why is method GetValue with 2 params invalid when the online doc
  tells me this method exists? Maybe a wrapping problem?
- How else can I read the values of vtkTable and/or vtkVarianArray
- Are there any examples available for the newer Vtk classes?

Thanks in advance for your help,

More information about the vtkusers mailing list