[Cartoweb-users] how to limit and reorder queryresults

oliver oliver.christen at camptocamp.com
Mon Apr 24 03:00:04 EDT 2006


Hi Bram,
I think most if not all what you need can be done with TableRules.

If not, you may try to extend the Table plugin.
Somthing like that allow to access and manage the table content:

class ClientSomeNameForThisPlugin extends ClientTables {

    public function replacePlugin() {
        return 'tables';
    }

    public function addTableGroups($tables) {

        if ($tables->groupId == 'query') {

            foreach ($tables->tables as $table) {
                if ($table->numRows > 0) {

                    // do some action 
                    print_r($table);

                    // add a row at bottom (exemple)
                    $row = new TableRow();
                    // ... set row content
                    $table->rows[$table->numRows - 1] = $row;
                }
            }
        }
        parent::addTableGroups($tables);
    }
}

?>

Regards,
Oliver

> Hi list,
> 
> I would like my queryresults to be (re)ordered according to the values 
> in a column. Also I would like to restrict the number of querysresults 
> according to a specific columnvalue, for instance give me only the three 
> largest cities within my bbox. As far as I can see I will need to use 
> the mapOverlay-plugin or the rowUnselector-tablerule. Maybe I should use 
> the postgis order by-clause, but in my shape-files that won't work.  Who 
> can give me a hint.
> 
> Thanks,
> 
> Bram
> _______________________________________________
> Cartoweb-users mailing list
> Cartoweb-users at lists.maptools.org
> http://lists.maptools.org/mailman/listinfo/cartoweb-users
>


More information about the Cartoweb-users mailing list