Home | Forums | Contact | Search | Syndication  
 
 [login] [create account]   Tuesday, July 8, 2025 
 
slxdeveloper.com Community Forums  
   
The Forums on slxdeveloper.com are now retired. The forum archive will remain available for the time being. Thank you for your participation on slxdeveloper.com!
 Architect Forums - SalesLogix Scripting & Customization
Forum to discuss writing script in Architect plugins for SalesLogix & general SalesLogix customization topics (for Windows client only). View the code of conduct for posting guidelines.
Forums RSS Feed


 Back to Forum List | Back to SalesLogix Scripting & Customization | New ThreadView:  Search:  
 Author  Thread: Formatting for column in datagrid
SLX_Novice
Posts: 246
 
Formatting for column in datagridYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 15 Jun 09 4:24 PM
Hi all.

How do I add a % at the end of an column (i.e. format string) in a datagrid, the field is a float in the sql table.

SLX LAN v7.2.1

Thank you in advance!
[Reply][Quote]
Kris Halsrud
Posts: 88
 
Re: Formatting for column in datagridYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 16 Jun 09 9:47 AM
IN the datagrid, there is a columns property. In the columns dialog you can bring up the properties for the column to format. Then there is a Format String property. I dont remember the exact format but I think it is something like ##.#% or similar.
[Reply][Quote]
RJ Samp
Posts: 973
Top 10 forum poster: 973 posts
 
Re: Formatting for column in datagridYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 16 Jun 09 9:54 AM
Go into the columns property of the datagrid. Change the column type for that column to Percent..... you can probably do this in the SQL property Query Builder LAYOUT as well.
[Reply][Quote]
SLX_Novice
Posts: 246
 
Re: Formatting for column in datagridYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 16 Jun 09 12:42 PM
Thanks for the reply!

I tried your suggestion but that doesn't work, it doesn't change the way the number appears in the datagrid.

I also tried RJ's suggestion and it adds the percentage but changes the value. So if I originally had 35.50 by changing the format type to "Percentage" it displays it as: 3,550%. The value is already the percentage, it's just not showing the % sign.
[Reply][Quote]
Deb R
Posts: 14
 
Re: Formatting for column in datagridYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 17 Jun 09 1:47 PM
Go to the script tab beside your Form(Design) tab
Scroll or search thru the script until you find the name of column whose format you want to change.
The column name should be the one after col.Caption =
In the group of settings there may be a row with "col.DisplayFormat =" like the example that follows.
If this row exists it does not matter what you place in the format string of the column properties, because this line supercedes it.
My suggestion would be to place a single quote in front of the row to make it a comment.
Then add another row either above or below it and set col.DisplayFormat = to the format you want to use.
Setting the format this way should not change the value of your output, it didn't on the form I tested it on anyway.

Example:
Set col = dgAdOrder.Columns.Add(13)
col.FieldName = "Percentage"
col.DisplayFormat = "##.##%"
' col.DisplayFormat = "$,0.000;-,0.000" 'Commented out on 6/17/2009
col.Caption = "Percentage"
col.Width = 60
col.ReadOnly = True
col.DisableEditor = True

Oh, and don't forget to go back in and change your column's type back to the original.
[Reply][Quote]
SLX_Novice
Posts: 246
 
Re: Formatting for column in datagridYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 17 Jun 09 3:27 PM
I don't have anything in the script tab.

The datagrid was created using the Columns property of the Datagrid.
[Reply][Quote]
Deb R
Posts: 14
 
Re: Formatting for column in datagridYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 17 Jun 09 4:33 PM
If you set the property, saved the form, released the form at least to yourself and either closed and re-opened the SalesLogix Client or pressed Ctrl-F5, changing the format property on the form as Kris suggested should have worked.

Something else must be blocking the column format property, unfortunately I do not know what it would be.



[Reply][Quote]
Dan Carvin
Posts: 227
 
Re: Formatting for column in datagridYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 20 Aug 09 11:33 AM
I'm trying to do a similar thing in the Opportunity Products grid, which is created with code in an include script.

We want to be able to enter decimals in the quantity field. In the default mode, if you enter 1.5 it rounds to 2. We want to be able to enter 2.5 or 3.75 and have it display that way.

I tried setting the col.DisplayFormat but I got an "object does not support method or property" error. Apparently, DisplayFormat works with a currency column type (13) but not Standard (0). I tried setting the colunm type to (13), but then it adds a $, which we don't want.

So is there another way to enter non-currency decimal numbers into editable datagrides?
[Reply][Quote]
RJ Samp
Posts: 973
Top 10 forum poster: 973 posts
 
Re: Formatting for column in datagridYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 27 Oct 09 3:36 PM
FormatString
[Reply][Quote]
Brian Mooy
Posts: 25
 
Re: Formatting for column in datagridYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 03 Dec 09 11:14 AM
Having recently struggled with doing this in a data grid (that I didn't want to program out into custom columns), I found the correct answer for the issue of formatting strings. I figured I'd update this to help in case anyone else is struggling (rather than start a new thread)

Lets assume you have a datagrid and a percent column, and you need to dislay three decimals. The datagrid's percent column automatically rounds to two decimals. That's a problem. When you're editing your grid and you are in the "Assign Query Layout" window, there is a 'format type' and a 'format' field. However, I have struggled in the past to determine how this format is supposed to be configured.

It would appear that the "Format" overrides the Format Type option. Dates are pretty straight forward, but numbers are a little bit confusing.

Also, it appears that the Format option is the delphi format. This link should help: http://www.delphibasics.co.uk/RTL.asp?Name=Format

To go back to the three decimal problem, the format would be:

%.3n

Which actually removes the percent symbol from your format. So if you need the percent symbol, the format is:

%.3n%% (two percent symbols to signify that you want to show a percent)

The next thing I'm trying to figure out is how to get a variable number of decimal places in this (not forcing it to three decimals) - and I'm not sure how to do that.

Hope this helps!
Brian
[Reply][Quote]
 Page 1 of 1 
  You can subscribe to receive a daily forum digest in your user profile. View the site code of conduct for posting guidelines.

   Forum RSS Feed - Subscribe to the forum RSS feed to keep on top of the latest forum activity!
 

 
 slxdeveloper.com is brought to you courtesy of Ryan Farley & Customer FX Corporation.
 This site, and all contents herein, are Copyright © 2025 Customer FX Corporation. The information and opinions expressed here are not endorsed by Sage Software.

code of conduct | Subscribe to the slxdeveloper.com Latest Article RSS feed
   
 
page cache (param): 7/8/2025 5:32:15 PM