Error executing code: Wrong argument types for comparison.
(C)\Data Dictionary\Tables\SysDataBaseLog\Methods\getDataAslist - line 28
(C)\Forms\SysDatabaseLog\Methods\buildContents - line 30
(C)\Forms\SysDatabaseLog\Data Sources\DBHistory\Methods\active - line 7
The actual issue is this, when we were in AX 3.0, we made a chance to a record, which was logged to Tables\SysDatabaseLog and had the ModifiedDate stored as a type of Date. Somewhere along the AX 3.0 to AX 4.0 to AX 2009, this data wasn't upgraded properly.
When the database log compare form tries to work with it, it's expecting to work with two utcDateTime objects for comparison, but it gets a Date and fails.
You can put this code in Tables\SysDatabaseLog\getDataAslist at around line 30 and see the issue in the debugger:
if (typeOf(conpeek(tmp, 2)) == Types::Date &&
dictField.baseType() == Types::UtcDateTime)
{
breakpoint;
}
You can write a hack with conPoke(...) and DateTimeUtil::newDateTime(...) to replace the Date with a utcDateTime, but you'll run into issues in other methods. The best thing to do is correct the data and I wrote a job to do just that. One specific thing to note, this is just proof of concept code...for our actual corrective actions, I wrote a class and table to do batches for various reasons since we have nearly 4 million records. As always, run at your own risk and test. Enjoy:
static void DatabaseLogFix(Args _args) { SysDataBaseLog log; container tmp; container newData; SysDictField dictField; fieldId fieldId; int i, idx; boolean updateCon; boolean updateData; Counter counter; #Properties; ; //select firstonly log where log.RecId == 5638018469; ttsbegin; while select forupdate log order by CreatedDateTime, RecId { updateData = false; if (typeof(conpeek(log.Data, 1)) == Types::Container) //Version 3.0 format { newData = log.Data; for (i=conlen(log.Data); i; i--) { updateCon = false; tmp = conpeek(log.Data, i); fieldId = conpeek(tmp, 1); dictField = new SysDictField(log.Table, fieldId); if (dictField) { if (dictField.name() == #PropertyModifiedTime || dictField.name() == #PropertyCreatedTime) { continue; } // Type mismatch for "New" value if (typeOf(conPeek(tmp, 2)) != dictField.baseType()) { // If it's a date that should be a utcDateTime, upgrade it if (typeOf(conpeek(tmp, 2)) == Types::Date && dictField.baseType() == Types::UtcDateTime) { tmp = conPoke(tmp, 2, DateTimeUtil::newDateTime(conPeek(tmp, 2), 0)); updateCon = true; } // Otherwise throw an error else { info(strfmt("[RecId %1][TableID %5][FieldId %2][2 NEW] Type mismatch (%3/%4)", log.RecId, fieldId, typeOf(conPeek(tmp, 2)), dictField.baseType(), log.table)); } } // Type mismatch for "Old" value if (typeOf(conPeek(tmp, 3)) != dictField.baseType()) { // If it's a date that should be a utcDateTime, upgrade it if (typeOf(conpeek(tmp, 3)) == Types::Date && dictField.baseType() == Types::UtcDateTime) { tmp = conPoke(tmp, 3, DateTimeUtil::newDateTime(conPeek(tmp, 3), 0)); updateCon = true; } // Otherwise throw an error else { info(strfmt("[RecId %1][TableID %5][FieldId %2][3 OLD] Type mismatch (%3/%4)", log.RecId, fieldId, typeOf(conPeek(tmp, 3)), dictField.baseType(), log.table)); } } if (updateCon) { updateData = true; newData = conPoke(newData, i, tmp); } } } if (updateData) { counter++; log.Data = newData; log.update(); } } } ttscommit; select count(RecId) from log; info(strfmt("%1 updates made against %2 records", counter, log.RecId)); }

I just had a case where I got a string value (Customer or Vendor ID) in the log for a custom float field on InventTable. AX 2009 from the start, apparently you don't need to upgrade to get corrupt data in DatabaseLog.
ReplyDeleteThat's strange. I'd guess you might have had added a custom string field to a table, typed some data, then changed the string field to a float. You would receive a synchronization warning that says "Warning this field will be dropped and recreated" or something to that sort.
DeleteAll is well, except that if you had DB logging turned on, that string field was recorded in the DB log, then it is now a float and it is a type mismatch. This would explain your error, but it's just my guess.
Very nice blog you have hhere
ReplyDeleteDengan menyediakan berbagai game yang modern, jujur, adil, merakyat dan nyentrik. Kini BANDARBOLA855 hadir untuk menemani keseharian anda dengan berbagai event dan kesempatan meraih kemenangan besar. rtp bandarbola855
ReplyDeleteOh my goodness! an excellent article dude. Many thanks However I am experiencing trouble with ur rss . Do not know why Not able to enroll in it. Will there be any person obtaining identical rss dilemma? Anyone who knows kindly respond. Thnkx Pink salt Trick
ReplyDeleteYour talent is really appreciated!! Thank you. You saved me a lot of frustration. I switched from Joomla to Drupal to the WordPress platform and Ive fully embraced WordPress. Its so much easier and easier to tweak. Anyway, thanks again. Awesome domain! AuDifort
ReplyDeleteIt was any exhilaration discovering your website yesterday. I arrived here nowadays hunting new things. I was not necessarily frustrated. Your ideas after new approaches on this thing have been helpful plus an superb assistance to personally. We appreciate you leaving out time to write out these items and then for revealing your thoughts. pink salt trick
ReplyDeleteWhen do you think this Real Estate market will go back in a positive direction? Or is it still too early to tell? We are seeing a lot of housing foreclosures in Altamonte Springs Florida. What about you? Would love to get your feedback on this.
ReplyDeleteSoulmate sketch
I real delighted to find this site on bing, just what I was looking for : D also bookmarked . solid surface
ReplyDeleteI real delighted to find this site on bing, just what I was looking for : D also bookmarked . situs slot
ReplyDeleteI was looking through some of your blog posts on this website and I conceive this site is very informative! Keep putting up. publizier.de
ReplyDeleteHowdy! I simply want to give a huge thumbs up for the nice info you will have here on this post. I will be coming back to your weblog for extra soon. 인천출장마사지
ReplyDeleteHowdy! I simply want to give a huge thumbs up for the nice info you will have here on this post. I will be coming back to your weblog for extra soon. 평택출장마사지
ReplyDeleteHowdy! I simply want to give a huge thumbs up for the nice info you will have here on this post. I will be coming back to your weblog for extra soon. 비아그라 구매
ReplyDeleteHowdy! I simply want to give a huge thumbs up for the nice info you will have here on this post. I will be coming back to your weblog for extra soon. 대전출장마사지
ReplyDeleteI can see that you are an expert at your field! I am launching a website soon, and your information will be very useful for me.. Thanks for all your help and wishing you all the success in your business. hooded sweatshirt men's
ReplyDeleteGood an very informative post. I will come back to your blog regullary. 안산출장마사지
ReplyDeleteIn the middle the talking starts and two advantages come to play for the side of the good guys, it will be a cliché sci-fi movie. 목포출장마사지
ReplyDeleteAs I web-site possessor I believe the content material here is rattling fantastic , appreciate it for your efforts. You should keep it up forever! Good Luck. rent a car kosovo 폰테크
ReplyDeleteMy brother suggested I might like this blog. He was entirely right. This post actually made my day. You cann’t imagine simply how much time I had spent for this info! Thanks! 전주출장마사지
ReplyDeleteHello” i can see that you are a really great blogger, Zoom555
ReplyDeleteWow that information is impressive it really helped me and our kids, cheers! 강남하이퍼블릭
ReplyDeleteDude.. My group is not considerably into looking at, but somehow I acquired to read several articles on your blog. Its fantastic how interesting it’s for me to visit you fairly often. 의정부출장마사지
ReplyDeleteSweet web site , super design and style , very clean and utilise pleasant. alexistogel
ReplyDeleteI believe that is among the such a lot important information for me. And i am glad studying your article. However wanna commentary on few normal things, The site taste is ideal, the articles is truly excellent . Just right process, cheers. 인천출장마사지
ReplyDeleteCurrently it looks like Drupal is the top blogging platform out there right now. (from what I’ve read) Is that what you are using on your blog? kebuntoto
ReplyDeletesomehow found your site when i was kind of stoned. good read 캔디약국
ReplyDeleteHiya, I am really glad I’ve found this information. Today bloggers publish just about gossips and web and this is really frustrating. A good blog with exciting content, this is what I need. Thanks for keeping this web site, I will be visiting it. Do you do newsletters? Can’t find it. 수원출장마사지
ReplyDelete