Automatic values on inp tables from child feature tables - Giswater/giswater_dbmodel GitHub Wiki

Mains:

This works with the system variable epa_automatic_man2inp_values but only with node features.

By default status is false: {"status":false, "values":[ {"sourceTable":"ve_node_deposito", "query":"UPDATE inp_tank t SET minlevel = h_min, maxlevel = h_max, diameter = diametro FROM ve_node_deposito s WHERE t.node_id = s.node_id"}, {"sourceTable":"ve_node_valvula_reductora_pres", "query":"UPDATE inp_valve t SET pressure = pression_exit FROM ve_node_valvula_reductora_pres s WHERE t.node_id = s.node_id"}]}

To configure:

  1. Change status to true
  2. Fill for each child feature view (sourceTable ) WRITE your own querytext wich you are looking to copy-paste values. WARNING: Use always inp tables as target tables, never use VIEWS.
  3. Update iseditable=false columns of v_edit_inp_* tables , wich value is automaticly triggered from child feature view (sourceTable). Ex: UPDATE config_form_fields SET iseditable = false WHERE formname ='v_edit_inp_valve' AND columnname = 'pressure' 4.Restart qgis project to apply this change.

How does it works?

  1. Each new inserted/updated row on sourceTable will lauch the query updating values defined on it.
  2. If you try to use some kind of reverse process, trying to update this epa_automatic_man2inp_values on v_edit_inp_ views, you will check that values will be not updated.
  3. Otherwise, if you try to update some values using inp_ tables (not v_edit_inp_ views), that value will be updated only on epa tables and it will not be updated on feature tables (sourceTable) and from that moment your data will have a fork.