Solved

GI Error after upgrade to 2023 R2

  • 11 April 2024
  • 5 replies
  • 53 views

Userlevel 3
Badge

We just upgraded from 2021 R2 to 2023 R2 and I noticed a generic inquiry that was throwing an error of: “Operand type clash: datetime2 is incompatible with int”

 

I looked at the DB on both 2021 and 2023 and the field “RequestDate” seems to be datetime2 in both versions. Does anybody know why this statement below would no longer work? If I swap these fields to add a +1 on the “ConfirmedDateTime” it works correctly by adding a day to the date.

I have a workaround but I was just curious why this is no longer working or a way to get it to work correctly.

 

=IIf(([SOShipment.ConfirmedDateTime]<=([SOLine.RequestDate] + 1)), 1, 0)

 

Thanks

icon

Best answer by BenjaminCrisman 11 April 2024, 16:32

View original

5 replies

Badge +18

Hello,

Did you notice this previous post containing the same error on datetime2 ?  I’m not 100% sure it will help you because the previous post was working in a Custom Process screen versus a GI.

HTH,

Laura

Userlevel 7
Badge +4

@jcox43 We would probably need to see the whole GI to get a better picture of the issue, but maybe there is an incorrect join or something?

I’m not a SQL expert by any means, but you’re taking a datetime field and just adding 1? Is there some default addition to date time where it knows to add days instead of months, years, or part of the time stamp?

If it were me I would make sure to explicitly define +1 day, maybe by using DateAdd() function, so like:

=IIf(([SOShipment.ConfirmedDateTime]<=(DateAdd([SOLine.RequestDate], ‘d’, 1)), 1, 0)

or just extract the day from both times and compare them using Day() function.

Userlevel 3
Badge

@jcox43 We would probably need to see the whole GI to get a better picture of the issue, but maybe there is an incorrect join or something?

I’m not a SQL expert by any means, but you’re taking a datetime field and just adding 1? Is there some default addition to date time where it knows to add days instead of months, years, or part of the time stamp?

If it were me I would make sure to explicitly define +1 day, maybe by using DateAdd() function, so like:

=IIf(([SOShipment.ConfirmedDateTime]<=(DateAdd([SOLine.RequestDate], ‘d’, 1)), 1, 0)

or just extract the day from both times and compare them using Day() function.

 

Benjamin,

I’ve attached the GI for you review if you wish.

Yes previously I only had =IIf(([SOShipment.ConfirmedDateTime]<=([SOLine.RequestDate] + 1)), 1, 0) and the +1 would increment correctly. As a workaround I have done exactly as you posted by using “DateAdd”. And now it works just like it used to.

No real issue here just trying to understand what changed. 

 

Thanks,

Userlevel 7
Badge +4

@jcox43 I can’t really understand why it would have worked before, though it could be something not in Acumatica documentation but SQL documentation instead, since it seems to be a function of SQL to understand which unit of time to increment.

If it was something Acumatica had allowed somehow then it was an undocumented feature lol

Userlevel 3
Badge

@jcox43 I can’t really understand why it would have worked before, though it could be something not in Acumatica documentation but SQL documentation instead, since it seems to be a function of SQL to understand which unit of time to increment.

If it was something Acumatica had allowed somehow then it was an undocumented feature lol

I’ll see about opening a support case with Acumatica just for some clarification. It’s odd that I can swap the +1 to the other field and if works.

 

I’ll mark a best answer for now but update if I figure out what’s happened.

 

Thanks,

Reply


About Acumatica ERP system
Acumatica Cloud ERP provides the best business management solution for transforming your company to thrive in the new digital economy. Built on a future-proof platform with open architecture for rapid integrations, scalability, and ease of use, Acumatica delivers unparalleled value to small and midmarket organizations. Connected Business. Delivered.
© 2008 — 2024  Acumatica, Inc. All rights reserved