3

At 3.18.3, is there a way to display Geopackage real attribute values in an attribute table (with table view) with a user-specified number of decimal places, while maintaining the data's internal precision?

For example, I may wish to display the records in a real field with two decimal places as 0.77, yet maintain its internal value of 0.7741935483870968.

Maintaining the internal value preserves future flexibility: some day I might have to perform a calculation that requires the full number of decimal places, or display the value with a different number of decimal places, for example 0.77419.

Perhaps related, when creating a real field using the field calculator, the output field length and precision options are greyed out:

enter image description here

I've searched SE for an answer, and also gone through the Settings > Options... with no joy.

1 Answer 1

2

I also have not found a way to specify a format to use for display in the same sense as is possible in, say, Excel (or other spreadsheets).

If you are comfortable to have the values read-only, there is a work around. Create a shadow virtual field like "test_example_" (note trailing _) and define it using the expression round("test_example",5) (or whatever number of digits). Then hide "test_example" in the attribute table and show only "test_example_".

1
  • Your solution works. I'm still curious why the Output Field Length and Precision options are greyed out (highlighted in the OP), so I'll ask that in a separate question.
    – Stu Smith
    Oct 16, 2021 at 5:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.