TransWikia.com

How to display real numbers with a desired number of decimal places when viewing an attribute table?

Geographic Information Systems Asked on July 25, 2021

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.

One Answer

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_".

Answered by Houska on July 25, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP