Monday, November 17, 2008

Delphi 2009 - How to treat warnings as errors

A long overdue addition to Delphi is the ability to treat compiler warnings as errors. I could have done with this some years ago and have really missed it since moving from C# back to Delphi a few months ago.

If you've had some trouble finding where to enable this option, I suggest you have read at this classic Daily WTF article and then have another go at looking for it.

Turns out that under the 'Hints and Warnings' section of the project options there is an option called 'Output Warnings'. Next to it is a drop down list with the default value of 'True'. Now most sane people would expect there to be only one more option in that drop down list. Turns it there is actually another two! Dropping down the list reveals all 3 options: 'True','False' and 'As Errors'

Hmmm. No wonder I couldn't find it.

I posted a question on Stack Overflow in case others are looking for it.

Sunday, October 26, 2008

Dynamic CRM 4.0 Data Migration Manager validation error - Line breaks

My company are in the process of migrating from Outlook Business Contacts Manager to Microsoft Dynamic CRM 4.0.

I've hit and overcame a few brick walls during this process, which is still ongoing. I've decided to document my findings in case anyone else comes up against the same problems.

The first problem I came up against and probably the most common is line breaks in your field data causes the validation process of the data migration manager to fail. It seems to see a line break as the start of a new field even when your data is surrounded by double quotes.

To be more specific it's a carriage return (Cr) followed by a line feed (Lf) that causes the problems. The only solution that I know of is to replace the CrLf pairs with just a Lf.

This can be easily done in Excel with a macro that you run over your worksheet.

Sub repLF()
Cells.Replace What:=vbCrLf, Replacement:=vbLf, LookAt:=xlPart, _SearchOrder:=xlByColumns, MatchCase:=False, SearchFormat:=False, _ReplaceFormat:=False
End Sub

For me that seems to get rid of most validation errors. I've looked at the imported data in the CRM and it seems to be OK i.e. line break still appear properly.

Hope that helps seem people who are facing the same problem.