Skip to main content
Solved

Unable to successfully convert date in import scenario


I have an excel source file which I am trying to import into a journal transaction with a transaction date of 2022-08-11 11:31:31.770

I have left the definition of my data provider field as string, in my import scenario definition I have tried various combinations of ideas from other articles most recently using 

=CDate(Substring([SourceTransactionDate],6,2) + '/' + Substring([SourceTransactionDate],9,2) + '/' + Substring([SourceTransactionDate],1,4))

and when I run my import scenario I get the following error

An error has occurred while the CDate(BinaryOp + (BinaryOp + (BinaryOp + (BinaryOp + (Substring(Identifier(SourceTransactionDate), Const(6), Const(2)), Const(/)), Substring(Identifier(SourceTransactionDate), Const(9), Const(2))), Const(/)), Substring(Identifier(SourceTransactionDate), Const(1), Const(4)))) function was being executed: 'String was not recognized as a valid DateTime.'

Thanks in advance

Best answer by RoyceLithgo

Substring is indexed from 0 not 1. Try this:

=CDate(Substring([SourceTransactionDate],5,2) + '/' + Substring([SourceTransactionDate],8,2) + '/' + Substring([SourceTransactionDate],0,4))

 

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

4 replies

Forum|alt.badge.img+3
  • Pro II
  • 76 replies
  • Answer
  • August 12, 2022

Substring is indexed from 0 not 1. Try this:

=CDate(Substring([SourceTransactionDate],5,2) + '/' + Substring([SourceTransactionDate],8,2) + '/' + Substring([SourceTransactionDate],0,4))

 


  • Author
  • Freshman II
  • 7 replies
  • August 12, 2022

Thank you for this suggestion, sadly I still get an error (albeit a different one) “Object must be of type DateTime”


DConcannon
Varsity II
Forum|alt.badge.img+2
  • Varsity II
  • 120 replies
  • August 15, 2022

FWIW, I think you may need to add a format statement. Without it, Acumatica may be expecting Time data too.  

@community If anyone has documented where and how to use format statements, can you share? This piece of info seems to be elusive.


  • Author
  • Freshman II
  • 7 replies
  • August 19, 2022

Oops! I had mapped the transaction date to BatchNumber > TransactionDate rather than TransactionDate.


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