date error. invalid date while importing data

kamranshehzadkamranshehzad Member Posts: 165
Date error is coming while importing data through xml port and code unit. 25/01/10' is not a valid date.

Any recommendations?
KS

Answers

  • jlandeenjlandeen Member Posts: 524
    Are you importing the string directly into a Date field/variable in Navision? If so you may want to import it into a string variable and then try to clean it up.

    I find dates (unless stored in a region agnostic format say the ISO 8601 standard for date times) can cause some confusion during imports as the region settings from one computer to another may be slightly different and thus different date values produce different results.
    Jeff Landeen - Sr. Consultant
    Epimatic Corp.

    http://www.epimatic.com
  • kamranshehzadkamranshehzad Member Posts: 165
    Thanks but the design of application is like this

    I am getting xml and mapping it to xml port schema in my application. Then passing it to a codeunit based webserivice and that passes the xml to xmlport to import the data in.

    Now if bring the dates as string in xml to code unit, then ill have to read the xml again in codeunit and then pass it xml port or shall i not validate date at all.

    When i import the same xml from a text file, it gets imported without any issue.

    please advise?
    regards,
    KS
  • jlandeenjlandeen Member Posts: 524
    Ok is there error when reading the date field into the XML Port or somewhere else in the process?

    If it's output of a date field from Navision into XML it may be that you need to format the fiedl differently. Normally when dates are exported they are exported in string format however date elements really should be represented as a proper XML formatted date (i.e. follow ISO 8601 standard) - if you use Format type 9 in any calls to the format function (this goes for dates, decimals, etc.) then the format function returns an XML compliant version of data. This means that decimals don't have a thousands seperator, dates are in ISO format, etc.
    Jeff Landeen - Sr. Consultant
    Epimatic Corp.

    http://www.epimatic.com
  • kamranshehzadkamranshehzad Member Posts: 165
    the structure is like

    in .net
    1) Incoming data > transform it to target schema using xslt to input xml
    2) pass input xml to code unit web service
    3) call code unit passes input xml to xmlport to import the data

    Here I get the date error. Date is as per format in database / system regional settings.
    I tried different date formats but still it gives that error.

    When i try reading the same xml from file (by saving input xml in a file) and pass it to xmlport through code unit, it works fine.

    I dont why is it through the error when passing it through .net code

    Any advice will help.

    regards,
    KS
  • kamranshehzadkamranshehzad Member Posts: 165
    just found it. it was just using a stupid format of date....
    my mistake.

    regards,
    KS
  • jlandeenjlandeen Member Posts: 524
    Nice to hear you solved your problem. Date formats and inconsistencies between systems and regional settings is a common annoyance and why I've started using the XML file format whenever possible as this can remove ambiguity.

    Good luck.
    Jeff Landeen - Sr. Consultant
    Epimatic Corp.

    http://www.epimatic.com
Sign In or Register to comment.