Page 1 of 1
Formatting numeric fields in Grids tied directly to database
Posted: Thu Apr 26, 2012 12:01 pm
by thutcheson
I have a grid that I have tied to a database file and selected the columns for display. For one of the columns, with numeric values, I want to format the values to show commas.
E.g.: value = 345456.77 I would like to display as 345,456.77
I can't find a property to control this type of formatting and I didn't see anything like this in the forums. Any suggestions?
Re: Formatting numeric fields in Grids tied directly to database
Posted: Wed Jun 28, 2017 2:58 pm
by pkenosky
bump... im also looking for this...
im using sql database-driven grid... i can convert the sql to varchar_format(), so it displays the number correctly like example above. However doing this causes the sort function to behave differently (will now sort based on char vs numeric)
thanks,
Paul K
Re: Formatting numeric fields in Grids tied directly to database
Posted: Wed Jun 28, 2017 3:30 pm
by Scott Klement
Hmm... sorting is handled by the "order by" property, whereas the formatting would be done by the "database fields" property. So I don't see why changing the field's format would affect sorting.
But, the way a database-driven grid works is to run an SQL statement, and put whetever the output is directly onto the grid. So you can use any of the capabilities of SQL to format your field. But, you cannot do programmatic formatting beyond that. If you want to do your own special formatting, then I would not recommend using a database-driven grid, I would load the grid from your code (RPG program or whatever you're using to drive the screen.)