Options

Input file validation

MarkReedaMarkReeda Member Posts: 12
Goodmorning everyone,

I'd like to ask a question about the validation of files to be imported into Microsoft Dynamics NAV 2017. Let me explain better, I often have to import (e.g. through XMLPort) files that come from third parties that have a "table structure" different from mine; concrete example, in my table I could have a field related to VAT that is populated with 22, while for the "external" one ( the one to be imported) is populated with "22%" (or maybe "Twentytwo", or "22 per cent", and so on and so forth). The question is: how can I validate these values? How can I transform them "respecting my standard"? In general I would like to understand if there is the possibility to make some operation during the import of an external file

I hope I've been sufficiently clear.

Thank you so much for your attention

Answers

  • Options
    KTA8KTA8 Member Posts: 391
    if you call the validate function on that field, you would raise the error.
  • Options
    MarkReedaMarkReeda Member Posts: 12
    But I don't want to raise the error. I'd like to understand if there is the possibility to modify the field!
  • Options
    Slawek_GuzekSlawek_Guzek Member Posts: 1,690
    One possible solution is to create a buffer table, with all text fields, import the file into the buffer, and then populate the destination table from the4 buffer, calculating correct values.

    Slawek Guzek
    Dynamics NAV, MS SQL Server, Wherescape RED;
    PRINCE2 Practitioner - License GR657010572SG
    GDPR Certified Data Protection Officer - PECB License DPCDPO1025070-2018-03
  • Options
    KTA8KTA8 Member Posts: 391
    MarkReeda wrote: »
    But I don't want to raise the error. I'd like to understand if there is the possibility to modify the field!

    Yes, you can. But the hard thing is how to find the pattern; maybe you should work with strpos to find that.
  • Options
    wolfskinwolfskin Member Posts: 84
    Create a table with all third parties text for mapping value between NAV and third parties. Something like this.

    Group | Third Parties Value | NAV Value
    VAT | 22% | 22
    VAT | Twentytwo | 22
    VAT | 2 per cent | 22
    VAT | ... | 22

    Write your code to access this table to get the NAV value.
Sign In or Register to comment.