Number formatting leading + or - Base 6.3 on Postgres 12

I need to have numbers displayed with a leading + or - in a Base form. I found instructions for doing so in Base, but when I set them, the data won’t post to Postgres. I’m using UTF-8 encoding in Postgres and the Postgres field type is “Real”, having had other problems with using “numeric”.

Base 6.3 Postgresql 12.0 running on Linux Mint 19.3.

Hello,

It would help if you posted the location of the instructions you found. Without this, have no idea what you may be looking at. Also, don’t know why you would have a problem with Number[numeric] fields as I use these without a problem.

Hi,
The instructions I used were to set a custom format in the fields in question of +0.00;-0.00,0

The problem I had with numeric was that any decimal number I entered would be rounded down to a whole number. I tried to solve this with confirming that the Base field was formatted -1234.12, and tried setting the Postgres column precision/scale to both unfilled and 5/2 as I wanted a max 999.99 in the data. Any number with decimal places entered in Base would post to the table rounded down to a whole number with no decimal places.

Using Real, things are working as expected except for the leading +.

Thanks for your help.

Hello,

Now I am further confused. Are you stating the only instruction you used was to use a pattern or formatted field (which)? Your question states you found instructions and that is what I was looking for - what instructions did you find? And are you expecting this leading + to be in the DB (nothing to do with Base - DB has no capability to do this to my knowledge)?

And the problem with your numeric field is that the decimal places were not set in the table field correctly if at all.

Hello again. The main source I used for the format I wanted to use was link text

I substituted the text I wanted, + -, for the exampled “plus” “minus”, nothing in place of “null”, and set each 0 to 0.00, which I understand to be std notation for 2DP. This was set in the properties-formatting of a “formatted field” control on the form.

My expectation was that the form would display in the format I had chosen eg +2.50, would post 2.50 (or possibly 2.5) to Postgres, and that should I wish to see +2.50 in a subsequent form, query or report, I would format the appropriate field to achieve this. On entering data into the form, I could enter a number, but save would be greyed out, and moving to another field in the form would clear the contents.

Is that enough information? If not could you be clearer as to what you require please?

On the Numeric issue, the Postgres field was created using pgAdmin 4, specifically table-column-edit-add function. Following the description from link text “The following illustrate the syntax of the NUMERIC type:
NUMERIC(precision, scale)
In this syntax, the precision is the total number of digits and the scale is the number of digits in the fraction part. For example, the number 1234.567 has the precision 7 and scale 3” and “If you omit both precision and scale, you can store any precision and scale up to the limit of the precision and scale mentioned above

Any advice as to what I have missed here would be appreciated.

Thank you for you kind and helpful assistance.

And I obviously don’t get how the hyperlink function works on this page. Reference in comment 2 above should read

https://help.libreoffice.org/4.4/Common/Number_Format_Codes#Text_and_Numbers

and on the comment above

https://www.postgresqltutorial.com/postgresql-numeric/

Hello,

Starting with the Numeric field. Your link is correct. Omit both precision and scale works when I set in pgAdmin4. Initially displaying in Base worked fine. However, adding a new record or modifying an existing one created problems which could not be fixed in Base. You should report as a problem → Bugzilla.

With using this format code +0.00;-0.00, had no problems:

Table definition:

image description

Table View:

image description

Form (fields):

image description

Form (grid):

image description

or Report:

This was tested with LO v7.0.0.3, on Ubuntu 20.04 Mate with PostgreSQL v12.3

Thank you. I can have another go at it armed with that knowledge.

Could I ask you to submit the report to Bugzilla, as I fear my ability to describe the problem accurately and using sufficiently precise terminology may degrade the report?

@PeterJammo,

I’m sure you will do OK with submitting your own Bug report.