Removing " and ' from a string before dataport export?

Matt.Hill
Member Posts: 32
Hi all
I need to be able to export the entire list of items from our inventory list as a CSV file so they can be used on an external distributor's system.
I've written a dataport that does just this and works fine, except for when the item's description contains any of the following characters: ' " or ,
The items description needs to be split across two fields as our descriptions are longer than their system can handle.
I've tried using ' DELCHR' but it says that the second parameter (the character I am trying to delete) is invalid!
So then I tried re-writing the dataport as a report, as I know I've achieve exporting item descriptions by enclosing the description in single quotes, e.g.
However, when I try (remember the description needs to be split):
I get the same 'errored' output file as I got with the dataport.
Does anyone know how I can get round this?
Thanks.
[/code]
I need to be able to export the entire list of items from our inventory list as a CSV file so they can be used on an external distributor's system.
I've written a dataport that does just this and works fine, except for when the item's description contains any of the following characters: ' " or ,
The items description needs to be split across two fields as our descriptions are longer than their system can handle.
I've tried using ' DELCHR' but it says that the second parameter (the character I am trying to delete) is invalid!
So then I tried re-writing the dataport as a report, as I know I've achieve exporting item descriptions by enclosing the description in single quotes, e.g.
ExportFile.WRITE("No." + ',"' + Description + '")
However, when I try (remember the description needs to be split):
ExportFile.WRITE("No." + ',"' + Desc1 + ',"' + Desc2 + '");
I get the same 'errored' output file as I got with the dataport.
Does anyone know how I can get round this?
Thanks.
[/code]
0
Comments
-
Description := DELCHR(Description,'=','"');
Or try TAB-seperated in the other system can read it.Regards,Alain Krikilion
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!0 -
you must use:
''',"'
( ' is doubled in the string)0 -
You can create Text Constants for ', " and the others and use DELCHR with them. Or a Char variable if you like it more explicit: DoubleQuoteChar := 34 and DELCHR(text, '=', FORMAT(DoubleQuoteChar));0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions