web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

Pipe and comma delimeter both in CSV file

(0) ShareShare
ReportReport
Posted on by

Team,

i want to impotrt csv file which will be in either pipe or comma . my code should handle both.

AsciiIo. import.inFieldDelimiter('|');  uses only one parameter . There is a way to do my declaring 2 class instnace of AsciiIo , but thats too much code. Any direct way pleae

Thanks

MAnoj

*This post is locked for comments

I have the same question (0)
  • Brandon Wiese Profile Picture
    17,788 on at

    Use XML and be done with CSV nonsense.

  • Manoj Veeramanoharan Profile Picture
    on at

    thanks Brandon . thats how client wants . they get files from another vendor though. thats why i need this to be done in file

  • Brandon Wiese Profile Picture
    17,788 on at

    My approach would be to build a base class for importing the file, and then create an abstract method to supply the delimiter.

    abstract str delimiter()
    {
    }

    Then extend that class into 2 more classes, one for comma and one for pipe, overriding the method for each

    Example,

    str delimiter()
    {
      return ',';
    }

    and,

    str delimiter()
    {
      return '|';
    }

    Then create two menu items.  Let the user tell you which kind of delimiter to expect by which menu item they choose and which class that launches.

    I think trying to support both randomly, line by line and character by character, is just asking for problems.

  • Brandon Wiese Profile Picture
    17,788 on at

    Then you would just do

    AsciiIo. import.inFieldDelimiter(this.delimiter()); 


  • Manoj Veeramanoharan Profile Picture
    on at

    Cool Brandon. thats a nice way too . else i can give 2 radiobox in the dialog  for pipe and comma . that way i can use only one menuitem

  • Brandon Wiese Profile Picture
    17,788 on at

    Yes, also good aproach.

    Otherwise, you have to worry about stuff like this

    15,000|24,000|Customer name|45

    Would that be commas or pipes?  You might be able to figure it out, but would a computer?

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Martin Dráb Profile Picture

Martin Dráb 4 Most Valuable Professional

#1
Priya_K Profile Picture

Priya_K 4

#3
MyDynamicsNAV Profile Picture

MyDynamicsNAV 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans