Postgres datasource and bigint

KJT
Bronze 1
Bronze 1

I use an external PostgreSQL database and have a problem with displaying field of type bigint. I entered the correct value "gsrn" in the form:

pic-3.png

After saving, the correct value of field gsrn is saved in database, but it is not correctly displayed in the view, the last digit is wrong (always 0):

pic-1.png

But, if I try to edit it, the correct value appears in the edit form again. So Appsheet reads and stores value correctly, just displaying is wrong. Is there any solution ? Saving as text is not an option, because it is external database and we are just using part of it...It looks like Appsheet's bug.

 

Solved Solved
0 3 78
1 ACCEPTED SOLUTION

It looks like your number is larger than what a NUMBER type column in AppSheet can accommodate:

AppSheet max  -->    9,007,199,254,740,992
Your number              452,115,580,110,597,809

What data type are you using in AppSheet for your value?  

I believe you can use Text column type in AppSheet and it will be converted correctly back and forth between AppSheet and the BigInt type in the database.  At least it worked as a test for me with Integer in a BigQuery database.

NOTE:  If you do use Text column type, you can use the NUMBER() function to test that entered data is indeed a number.  Not sure of results when the number exceeds the maximum of the app Number data type BUT AppSheet databases support 64-bit numbers (a much larger number) so I would think the app NUMBER() function can handle the larger numbers.

I hope this helps!

View solution in original post

3 REPLIES 3

It looks like your number is larger than what a NUMBER type column in AppSheet can accommodate:

AppSheet max  -->    9,007,199,254,740,992
Your number              452,115,580,110,597,809

What data type are you using in AppSheet for your value?  

I believe you can use Text column type in AppSheet and it will be converted correctly back and forth between AppSheet and the BigInt type in the database.  At least it worked as a test for me with Integer in a BigQuery database.

NOTE:  If you do use Text column type, you can use the NUMBER() function to test that entered data is indeed a number.  Not sure of results when the number exceeds the maximum of the app Number data type BUT AppSheet databases support 64-bit numbers (a much larger number) so I would think the app NUMBER() function can handle the larger numbers.

I hope this helps!

When importing table to Appsheet, it automaticaly sets Number format for bigint field. 
I found ugly workaroud. I created a virtual column with formula TEXT([gsrn]) and it displays correct value. So I use virtual column for display and real column for input. But if you have many fields that is a lot of aditional fields and work and big chance of display wrong field..
I'll also try your solution, just setting field to text format and will see. Thank you for your suggestion!

Using Text column type for bigint variable actually works. Thanks for the solution!