Skip to main content
Answer

Import Scenario Issue

  • May 22, 2025
  • 2 replies
  • 52 views

Forum|alt.badge.img+3

Hi i am trying to create a import scenario for purchase order screen. Everything works fine But when i am trying to -1 from date its showing me errors. What i want is to create PO with -1 date. For example if i am creating PO by import scenario so date will be yesterday not today.

Please ignore date formula above. I was just trying this. Can anyone guide me on how to write this
=DateAdd('d', -1, CDate(Left(Right([ORDER DATE],4),2) + '/' + Right([ORDER DATE],2) + '/' + Left([ORDER DATE],4)))

Error :

 

An error occurred while executing the DateAdd(Const(d), UnaryOp: - (Const(1)), CDate(BinaryOp + (BinaryOp + (BinaryOp + (BinaryOp + (Left(Right(Identifier(ORDER DATE), Const(4)), Const(2)), Const(/)), Right(Identifier(ORDER DATE), Const(2))), Const(/)), Left(Identifier(ORDER DATE), Const(4))))) function. Type mismatch in the argument 1 of the DateAdd() function: The argument must have the DateTime type.

 

Best answer by tahayabali

This is solved thanks.

=DateAdd( CDate(Substring(CStr([ORDER DATE]), 4, 2) + '/' + Substring(CStr([ORDER DATE]), 6, 2) + '/'+ Substring(CStr([ORDER DATE]), 0, 4)), 'd', -1 )

2 replies

Forum|alt.badge.img+3
  • Author
  • Captain I
  • May 23, 2025

=CDate(Substring([ORDER DATE], 4, 2) + '/' + Substring([ORDER DATE], 6, 2) + '/' + Substring([ORDER DATE], 0, 4))

above formula is working but when i subtract it its not working fine and giving me error.

 

 

An error occurred while executing the DateAdd(Const(d), UnaryOp: - (Const(1)), CDate(BinaryOp + (BinaryOp + (BinaryOp + (BinaryOp + (Substring(Identifier(ORDER DATE), Const(4), Const(2)), Const(/)), Substring(Identifier(ORDER DATE), Const(6), Const(2))), Const(/)), Substring(Identifier(ORDER DATE), Const(0), Const(4))))) function. Type mismatch in the argument 1 of the DateAdd() function: The argument must have the DateTime type.


Forum|alt.badge.img+3
  • Author
  • Captain I
  • Answer
  • May 23, 2025

This is solved thanks.

=DateAdd( CDate(Substring(CStr([ORDER DATE]), 4, 2) + '/' + Substring(CStr([ORDER DATE]), 6, 2) + '/'+ Substring(CStr([ORDER DATE]), 0, 4)), 'd', -1 )