Skip to content

NTFormsFillComboFromPGSQL

amaneiro edited this page Jan 24, 2012 · 4 revisions

The alias and the value is expected to be stored in the same table. It's an usual configuration, for example, having specific tables where defining pairs alias/value.

Step1: what to write in the xml

<FIELD>
    <FIELDNAME>gestion</FIELDNAME> <!-- field to fill with domain values -->
    <DOMAINREADER>
    <DRTYPE>db</DRTYPE> <!-- domainreader is a databasereader -->
    <DRDBTABLE>yourtable</DRDBTABLE> <!-- table in database -->
    <DRDBCOLUMNALIAS>youralias</DRDBCOLUMNALIAS> <!-- what will be shown in the combo -->
    <DRDBCOLUMNVALUE>yourvalue</DRDBCOLUMNVALUE> <!-- key stored/retrieved from datasource -->
    </DOMAINREADER>
</FIELD>

Step2: how to manage the connection to the database

Your extension should depends on extDBConnection, a gvsig plugin which easy the task of manage the connection to a database.

Before launching the form, you should connect to the database by means of extDBConnection utilities.

Step 3: compile and enjoy!