Error importing from .csv

Curtis2009Curtis2009 Member Posts: 13
Hi all, im developing a dataport to import data from a .csv file. I have a lot of blank dates, and im getting the error " '00000000' is an invalid date" when trying to import. Already tried
IF Date=< 0D then CurrDataPort.SKIP but it does not work. Already searched the forum and didnt find any solution, so any help will be appreciated. Thanks ](*,)

Answers

  • matttraxmatttrax Member Posts: 2,309
    Instead of importing directly into the field, use a temp variable of type text.

    Add code IF EVALUATE(DateField, TempText) THEN;

    That way if you get a bad date it won't fill in the field. You could also do a SKIP here if you want to skip the record entirely.
  • DenSterDenSter Member Posts: 8,304
    I would do something like:
    IF NOT EVALUATE(DateField, TempText) THEN
      DateField := 0D;
    
    By the way, you can evaluate incoming values in the OnBeforeEvaluateField trigger of the dataport field. That way you don't have to create a temporary variable.
  • Curtis2009Curtis2009 Member Posts: 13
    Thanks for the replys. Infortunately im still getting the same error ](*,) . I finally got a non blank date, and it's 20090930. I guess i need to convert this to navision standard right?

    Edit: That was it, already solved. Thank you all \:D/
Sign In or Register to comment.