Community
Showing results for 
Search instead for 
Do you mean 
Reply

Display value of date field not correct

Accepted Solution Solved
New Member
Posts: 9
Country: USA
Accepted Solution

Display value of date field not correct

I'm attempting to clear out the value of a date field on the Contact detail view, but even though the value is removed from the Contact object it's still displayed on the screen.  If I leave the contact and then come back the correct (empty) value is displayed.

 

Here's the code I use to clear the value:

 

currentContact.ContactFields[fieldAlias, Act.Framework.MutableEntities.FieldNameType.Alias] = null;
currentContact.Update();
if (fieldAlias == "DATE CONTRACT SENT")
{
     application.CurrentView.RefreshView();
     //application.RefreshLoadedViews();
}

 The .RefreshView() and .RefreshLoadedViews() don't seem to help at all and aren't required when clearing other (non-date controls) fields as they display properly when modified via code.


Accepted Solutions
Solution
Accepted by topic author tpoulos
‎09-25-2015 03:20 AM
Employee
Posts: 1,163
Country: USA

Re: Display value of date field not correct

It is strange, must have something to do with how that particular control handles null values.

 

Have you tried ActApp.Refresh() instead of the ones specific to the views? (Just curious, I'd have expected the other two refershes to work as well)

Matthew Wood
Act! SDK Support
Community Moderator

View solution in original post


All Replies
Employee
Posts: 1,163
Country: USA

Re: Display value of date field not correct

Does it also fail to update the date field if we change the date instead of trying to pass it a null value?

Matthew Wood
Act! SDK Support
Community Moderator
New Member
Posts: 9
Country: USA

Re: Display value of date field not correct

Nope, it displays the correct value if changed to something other than null.  Other (non-date) field display correctly when set to either another value or to null.

 

It's also strange that if I choose View | Refresh from the menu or hit the F5 key the correct (null) value is displayed in the date field controls.  Since the F5/Refresh works I thought I should be able to duplicate that through code using .RefreshView() or .RefreshLoadedViews() but that doesn't seem to work.

Solution
Accepted by topic author tpoulos
‎09-25-2015 03:20 AM
Employee
Posts: 1,163
Country: USA

Re: Display value of date field not correct

It is strange, must have something to do with how that particular control handles null values.

 

Have you tried ActApp.Refresh() instead of the ones specific to the views? (Just curious, I'd have expected the other two refershes to work as well)

Matthew Wood
Act! SDK Support
Community Moderator
New Member
Posts: 9
Country: USA

Re: Display value of date field not correct

Thanks Matthew, that one works for some reason.  It does produce a pretty noticable screen flash, but I can live with that for now.

Nickel Contributor
Posts: 175
Country: USA

Re: Display value of date field not correct

Just a thought on the control. It doesn't look like the "default" .NET DateTimePicker, but I know that it (the .NET DateTimePicker) at least had some pretty major issues with it. This was in .NET 2.0 for sure, and I've never really checked to see if Microsoft fixed it in 3.5 or 4. It couldn't handle null values from databases, and it had some weird focus issues. You could just search ".net nullable datetimepicker" on your favorite search engine and turn up numerous results.

 

Knif