Options

XMLport, several FieldDelimiters?

RydenRyden Member Posts: 24
edited 2014-09-23 in NAV Three Tier
Hi!

I'm Writing a XMLport that imports a CSV file.
Mostly this file comes separated with TAB but occationally it comes separated by semicolon.

Is there a way to have the XMLport handle muliple field delimiters? I have tried but it seems it only allows one delimiter
--
www.nabsolutions.se

Comments

  • Options
    tinoruijstinoruijs Member Posts: 1,226
    There's a property FIELDDELIMITER on a xmlport.
    From help: You can set the field delimiter in C/AL code so that the XMLport can import and export records with different delimiters. For example, if your XMLport must import from a file or stream where one record uses commas and another uses an empty string, you can change the field delimiter property at run time.

    Tino Ruijs
    Microsoft Dynamics NAV specialist
  • Options
    RydenRyden Member Posts: 24
    Ok, so it can only handle one delimiter at a time. That's what I figured.
    I put in a field in the Request Page to let the user choose the delimiter before the XMLport is run.
    --
    www.nabsolutions.se
  • Options
    RydenRyden Member Posts: 24
    First of all, I must apologize for some possible confusion, I'm talking about Field Separators, not Delimiters. My bad.

    Next problem concerns Globals as input to the FieldSeparator property

    I put a textfield on the request page to set the separator, initial value is <TAB>, SourceExpression for this field is set to gFieldSeparator
    In XMLport properties I set SourceExpression fpr FieldSeparator to gFieldSeparator as well.

    This works lika charm in my development environment, I can separate by tab, by semicolon, by comma etc. but when we delivered the code to the customer it just wouldn't work, the lines where never chopped up at all no matter what we tried. Debug shows that gFieldSeparator does indeed change it's value but it has no effect.
    I had to revert to a hard coded <TAB> in the properties.

    It's a NAV 2013, anybody recognize this behavior?
    --
    www.nabsolutions.se
Sign In or Register to comment.