Skip to main content
Solved

GI Error after upgrade to 2023 R2


Forum|alt.badge.img

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

Best answer by BenjaminCrisman

@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.

View original
Did this topic help you find an answer to your question?

6 replies

Laura02
Captain II
Forum|alt.badge.img+19
  • Captain II
  • 3132 replies
  • April 11, 2024

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


BenjaminCrisman
Acumatica Employee
Forum|alt.badge.img+4
  • Acumatica Support Team
  • 706 replies
  • Answer
  • April 11, 2024

@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.


Forum|alt.badge.img
  • Author
  • Freshman I
  • 26 replies
  • April 11, 2024
BenjaminCrisman wrote:

@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,


BenjaminCrisman
Acumatica Employee
Forum|alt.badge.img+4
  • Acumatica Support Team
  • 706 replies
  • April 11, 2024

@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


Forum|alt.badge.img
  • Author
  • Freshman I
  • 26 replies
  • April 15, 2024
BenjaminCrisman wrote:

@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,


Ehren_Dimitry
Freshman II

Any update on this? We just upgraded to 2023 R2 and we have the same error with one of our GIs..

This is part of the formula being used. I am trying to establish the first day of the week (Monday) for each requested date. 

=IIF(DayOfWeek([SOLine.RequestDate])=1,[SOLine.RequestDate]+1)


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings