Skip to main content
Commonmark migration
Source Link

I solved my problem with the following approach:

In the field which holds the boolean value, I defined a checkbox as edit widget under layer properties -> fieöds and set the representation for checked as t and for unchecked as f ( see image) [![enter image description here][1]][1]enter image description here

Another but similar approach is to use a value map field and use the two options (image 2)

[![enter image description here][2]][2]enter image description here

I then defined a standard layer style for my layer in QGIS and saved this style into the database with properties -> style(the button down left) -> Save as default -> Save to datasource database

So every time I load the layer the bool field is shown as checkbox which is either t or f and which is understood by Postgres as a boolean value and if I query the field inside postgres with:

SELECT bool_field from my_table 

I get something like

bool_field: false, false. true, ... [1]: https://i.sstatic.net/GZlmy.png [2]: https://i.sstatic.net/h6SLw.png

I solved my problem with the following approach:

In the field which holds the boolean value, I defined a checkbox as edit widget under layer properties -> fieöds and set the representation for checked as t and for unchecked as f ( see image) [![enter image description here][1]][1]

Another but similar approach is to use a value map field and use the two options (image 2)

[![enter image description here][2]][2]

I then defined a standard layer style for my layer in QGIS and saved this style into the database with properties -> style(the button down left) -> Save as default -> Save to datasource database

So every time I load the layer the bool field is shown as checkbox which is either t or f and which is understood by Postgres as a boolean value and if I query the field inside postgres with:

SELECT bool_field from my_table 

I get something like

bool_field: false, false. true, ... [1]: https://i.sstatic.net/GZlmy.png [2]: https://i.sstatic.net/h6SLw.png

I solved my problem with the following approach:

In the field which holds the boolean value, I defined a checkbox as edit widget under layer properties -> fieöds and set the representation for checked as t and for unchecked as f ( see image) enter image description here

Another but similar approach is to use a value map field and use the two options (image 2)

enter image description here

I then defined a standard layer style for my layer in QGIS and saved this style into the database with properties -> style(the button down left) -> Save as default -> Save to datasource database

So every time I load the layer the bool field is shown as checkbox which is either t or f and which is understood by Postgres as a boolean value and if I query the field inside postgres with:

SELECT bool_field from my_table 

I get something like

bool_field: false, false. true, ...

added infos
Source Link
LaughU
  • 4.2k
  • 5
  • 23
  • 42

I solved my problem with the following approach:

In the field which holds the boolean value, I defined a checkbox as edit widget under layer properties -> fieöds and set the representation for checked as t and for unchecked as f ( see image) [![enter image description here][1]][1]

Another but similar approach is to use a value map field and use the towtwo options (image 2)

[![enter image description here][2]][2]

I then defined a standard layer style for my layer in QGIS and saved this style into the database with properties -> style(the button down left) -> Save as default -> Save to datasource database

So every time I load the layer the bool field is shown as checkbox which is either t or f and which is understood by PostGISPostgres as a boolean value and if I query the field inside postgres with:

SELECT bool_field from my_table 

I get something like

bool_field: false, false. true, ... [1]: https://i.sstatic.net/GZlmy.png [2]: https://i.sstatic.net/h6SLw.png

I solved my problem with the following approach:

In the field which holds the boolean value, I defined a checkbox as edit widget under layer properties -> fieöds and set the representation for checked as t and for unchecked as f ( see image) [![enter image description here][1]][1]

Another but similar approach is to use a value map field and use the tow options (image 2)

[![enter image description here][2]][2]

I then defined a standard layer style for my layer in QGIS and saved this style into the database with properties -> style(the button down left) -> Save as default -> Save to datasource database

So every time I load the layer the bool field is shown as checkbox which is either t or f and which is understood by PostGIS as a boolean value [1]: https://i.sstatic.net/GZlmy.png [2]: https://i.sstatic.net/h6SLw.png

I solved my problem with the following approach:

In the field which holds the boolean value, I defined a checkbox as edit widget under layer properties -> fieöds and set the representation for checked as t and for unchecked as f ( see image) [![enter image description here][1]][1]

Another but similar approach is to use a value map field and use the two options (image 2)

[![enter image description here][2]][2]

I then defined a standard layer style for my layer in QGIS and saved this style into the database with properties -> style(the button down left) -> Save as default -> Save to datasource database

So every time I load the layer the bool field is shown as checkbox which is either t or f and which is understood by Postgres as a boolean value and if I query the field inside postgres with:

SELECT bool_field from my_table 

I get something like

bool_field: false, false. true, ... [1]: https://i.sstatic.net/GZlmy.png [2]: https://i.sstatic.net/h6SLw.png

Source Link
LaughU
  • 4.2k
  • 5
  • 23
  • 42

I solved my problem with the following approach:

In the field which holds the boolean value, I defined a checkbox as edit widget under layer properties -> fieöds and set the representation for checked as t and for unchecked as f ( see image) [![enter image description here][1]][1]

Another but similar approach is to use a value map field and use the tow options (image 2)

[![enter image description here][2]][2]

I then defined a standard layer style for my layer in QGIS and saved this style into the database with properties -> style(the button down left) -> Save as default -> Save to datasource database

So every time I load the layer the bool field is shown as checkbox which is either t or f and which is understood by PostGIS as a boolean value [1]: https://i.sstatic.net/GZlmy.png [2]: https://i.sstatic.net/h6SLw.png