you need to define 2 DB fields used for the OPTIONS, one for the key 
used for the search and one for the displayed value, they can be the 
same if you do not want to use an ID field, like

... SELECT DISTINCT nombre, nombre FROM ...


On 07/11/2011 20:14, salo wrote:
>
> Hello everyone,
>
> I have defined the following search options:
>
> <searchitem name="mpios3" description="Municipios Options PG">
>          <layer type="postgis" name="municipios">
>              <field type="s" name="nombre" description="Municipio:"
> wildcard="2">
>                  <definition type="options" connectiontype="db" sort="asc">
>                      <dsn
> encoding="UTF-8">pgsql://postgres:postgres@localhost/pizano</dsn>
>               <sql>SELECT DISTINCT nombre FROM municipios WHERE nombre IS NOT 
> NULL
> ORDER BY                        nombre</sql>
>                  </definition>
>              </field>
>          </layer>
>      </searchitem>
>
>
> When I run the search on pmapper the listbox appears void, such as you can
> see in the image attachment
> http://old.nabble.com/file/p32788741/error_search_option_postgis.jpg
> error_search_option_postgis.jpg , and when I saw the pm_debug.log file I
> found the following:
>
> [07-Nov-2011 19:48:33] P.MAPPER debug info
> XML->//definition
>   SimpleXMLElement Object
> (
>      [@attributes] =>  Array
>          (
>              [type] =>  options
>              [connectiontype] =>  db
>              [sort] =>  asc
>          )
>
>      [dsn] =>  pgsql://postgres:postgres@localhost/pizano
>      [sql] =>  SELECT DISTINCT nombre FROM municipios WHERE nombre IS NOT NULL
> ORDER BY nombre
> )
>
> [07-Nov-2011 19:48:33] P.MAPPER debug info
> search.php->getOptionsFromDb()
>   SELECT DISTINCT nombre FROM municipios WHERE nombre IS NOT NULL ORDER BY
> nombre
>
> [07-Nov-2011 19:48:33] P.MAPPER debug info
> search.php->getOptionsFromDb()->json
>   { "?":"", "ABEJORRAL":"", "ÁBREGO":"", "ABRIAQUÍ":"", "ACACÍAS":"",
> "ACANDÍ":"", "ACEVEDO":"", "ACHÍ":"", "AGRADO":"", "AGUA DE DIOS":"",
> "AGUACHICA":"", "AGUADA":"", "AGUADAS":"", "AGUAZUL":"", "AGUSTÍN
> CODAZZI":"", "AIPE":"", "ALBÁN":""}
>
> Please somebody help me!
>
> Kind Regards.
>
>


------------------------------------------------------------------------------
RSA(R) Conference 2012
Save $700 by Nov 18
Register now
http://p.sf.net/sfu/rsa-sfdev2dev1
_______________________________________________
pmapper-users mailing list
pmapper-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/pmapper-users

Reply via email to