Home | Forums | Contact | Search | Syndication  
 
 [login] [create account]   Tuesday, November 26, 2024 
 
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: Dynamically adding a Date column to a Datagrid
Stuart
Posts: 178
 
Dynamically adding a Date column to a DatagridYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 20 Sep 06 5:13 AM
fiogf49gjkf0d
I have read the excellent article at http://www.slxdeveloper.com/page.aspx?id=35&articleid=26 but I have the same problem that Ed Wagner mentioned in the discussion following it, and I can't see a solution. I am doing this:

Set col = grdProducts.Columns.Add(3)
col.FieldName = "START_DATE"
col.Caption = Application.Translator.Localize("Start Date")
col.Width = 50
col.FormatType = ftDateTime ' Is this correct?

START_DATE is defined as a datetime, and it displays the date correctly as 12/1/2006 but when I click it I get;

Error
'12/1/2006' is not a valid floating point number

What am I doing wrong please?

Thanks in advance.
[Reply][Quote]
Stuart
Posts: 178
 
Re: Dynamically adding a Date column to a DatagridYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 20 Sep 06 9:29 AM
fiogf49gjkf0d
I should have said this is SLX 6.2.3

[Reply][Quote]
Jeff Crawford
Posts: 52
 
Re: Dynamically adding a Date column to a DatagridYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 20 Sep 06 1:22 PM
fiogf49gjkf0d
Stuart,

Try changing your format type property to a value of 3.

col.FormatType = 3


If that doesn't work, try changing column type to Standard (0) and using format type = 3.

Set col = grdProducts.Columns.Add(0)
...
col.FormatType = 3

~JC
[Reply][Quote]
Stuart
Posts: 178
 
Re: Dynamically adding a Date column to a DatagridYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 21 Sep 06 3:04 AM
fiogf49gjkf0d
Thanks Jeff, the second of those worked, in that the error stopped. However, like this its effectively a text field with no specific date validation. I was hoping to get a calendar control when clicking on the date. Any idea how to achieve this?


[Reply][Quote]
Jeff Crawford
Posts: 52
 
Re: Dynamically adding a Date column to a DatagridYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 21 Sep 06 10:17 AM
fiogf49gjkf0d
It sounds to me like there may be a bug with the datagrid control and that column type. If this is an acceptable work around, you could create an edit form to update the datagrid row, instead of letting the users directly update the datagrid itself.
[Reply][Quote]
Stuart
Posts: 178
 
Re: Dynamically adding a Date column to a DatagridYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 21 Sep 06 2:18 PM
fiogf49gjkf0d
Quote:
Originally posted by Jeff Crawford

It sounds to me like there may be a bug with the datagrid control and that column type.

I agree, it looks like that.
Quote:
If this is an acceptable work around, you could create an edit form to update the datagrid row, instead of letting the users directly update the datagrid itself.

That's worth thinking about, thanks for the suggestion.

[Reply][Quote]
Jeremy Brayton
Posts: 491
Top 10 forum poster: 491 posts
 
Re: Dynamically adding a Date column to a DatagridYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 22 Sep 06 12:41 PM
fiogf49gjkf0d
I've never liked the built in date validation so I turn it off. I also disable the editor so the only way a date can be entered is by pressing the calendar button. This keeps dates relatively validated but there's a DateColumnValidate (or whatever it's called) event in 6.2 that lets you validate your dates outside of the normal routine if you absolutely need it.

I doubt any of what I said will make a difference in regards to the problem. You could creating a date column manually but set it to invisible. Then when you need a date column dynamically you just clone the invisible column. The only issue with this is there is no Clone method and I'm not sure if the extended properties like "Disable Editor" are accessable through code. If they are then you can clone a column by just iterating through each property (difficult) but if they aren't I would think you could just setup a datecolumn object and pass it to the Add method to clone it.
[Reply][Quote]
Stuart
Posts: 178
 
Re: Dynamically adding a Date column to a DatagridYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 14 Nov 06 8:17 AM
fiogf49gjkf0d
Quote:
Originally posted by Stuart
START_DATE is defined as a datetime


I have just come back to this, and have found the problem. If anyone is interested, if you try to make a Date/Time column a type (3) you will get the error I mentioned when you click it. Defining the column as just 'Date' in DB Manager makes it work as expected, with a nice calendar control.


[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 © 2024 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): 11/26/2024 10:31:39 PM