Formatting numeric fields in Grids tied directly to database

Use this board to ask questions or have discussions with other Rich Displays users.
Post Reply
thutcheson
New User
Posts: 16
Joined: Wed Apr 18, 2012 1:45 pm
First Name: Tony
Last Name: Hutcheson
Company Name: StoneRiver
Phone: 4073825920
Address 1: 16000 Research Pkwy
Address 2: ste 200
City: Orlando
State / Province: Florida
Zip / Postal Code: 32826
Country: United States
Contact:

Formatting numeric fields in Grids tied directly to database

Post 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?
pkenosky
New User
Posts: 12
Joined: Mon Dec 19, 2016 12:25 pm
First Name: paul
Last Name: kenosky
Company Name: keystone auto
State / Province: Pennsylvania
Contact:

Re: Formatting numeric fields in Grids tied directly to database

Post 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
Scott Klement
Experienced User
Posts: 2711
Joined: Wed Aug 01, 2012 8:58 am
First Name: Scott
Last Name: Klement
Company Name: Profound Logic
City: Milwaukee
State / Province: Wisconsin

Re: Formatting numeric fields in Grids tied directly to database

Post 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.)
Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests