Search code examples
postgresqllookup-tableslibreoffice-base

lookup table in Postgres and libre Base not populating


I have a postgreSQL 9.5 database connected to with LibreBase trying to build a work order tracking app. I am trying to build a lookup filed with drop downs in my form but I get relation does not exist error when I link it to the listbox. It works when I use the embedded libre database but not in the Postgres database. I cannot build the relationship in librebase because the driver does not seem to support that function within postgres. How do I build the relationship between 2 tables using pgAdminIII? Can I have one lookup table assigned to 2 fields in the same table?


Solution

  • pgAdminIII Right Click Constraints add foreign key.... you'd think that would be easier to find.

    In Libre Base set the form field to listbox and go into control. There in the data tab set the table column and the list values to SQL. Using SQL build a query (I used the graphic query) with a full (Inner Join?) join your table with the lookup table, ensure only the value field is visible. When you save and enter the form you should have a drop down look up that shows the string value in the form but stores the id_num (or the field value you used in the relate SQL) in the table.

    For some reason all the directions I could find to do this either involved making a domain list or a relate using the "relationship" GUI of which does not allow you to use the same lookup table for 2 different field (At least is didn't work for me anyway).