<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet type="text/css" href="https://www.schweda.net/style_feed.css" ?>
<rss version="2.0" 
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
    xmlns:atom="http://www.w3.org/2005/Atom"	
	xmlns:dc="http://purl.org/dc/elements/1.1/" > 
<channel>
    <title>schweda.net - Blog</title>
    <link>https://www.schweda.net/</link>
    <description>schweda.net - Blog - Blog-Beitraege</description>
    <language>de-at</language>
    <copyright>Copyright 2006-2026</copyright>
    <generator>schweda.net</generator>
    <managingEditor>heinz.schweda@schweda.net (Heinz Schweda)</managingEditor>
    <webMaster>heinz.schweda@schweda.net (Heinz Schweda)</webMaster>
    <category>Blog</category>
	<atom:link href="https://schweda.net/blog_rss.php?bid=202" rel="self" type="application/rss+xml" />
<item>
<title><![CDATA[CSV-Datei und Zeilenumbrüche]]></title>
<description><![CDATA[
<p>Wenn man aus AX Daten in eine CSV-Datei exportieren muss, gibt es immer wieder Probleme mit Zeilenumbr&uuml;chen in mehrzeiligen AX-Feldern.
</p>


<p>Um diese zu umgehen, m&uuml;ssen lediglich folgende Punkte beachtet werden:
</p>


<ul>
	
<li>Der Text muss in <strong>doppelte Anf&uuml;hrungszeichen (&quot;) eingeschlossen</strong> werden
</li>
	
<li>Der <strong>RecordDelimiter</strong> des TextIO-Objekts muss ein Linefeed sein [=num2char(10)]
</li>
	
<li>Doppelte Anf&uuml;hrungszeichen im Text m&uuml;ssen &quot;verdoppelt&quot; werden
</li>

</ul>


<p>&nbsp;
</p>


<div class="div_blog_axcode">static void Export_CSV(Args _args)<br />
{<br />
&nbsp;&nbsp;&nbsp; TextIO&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; textFile;<br />
&nbsp;&nbsp;&nbsp; CustTable&nbsp;&nbsp; CustTable;<br />
<br />
&nbsp;&nbsp;&nbsp; str csv(str _str)<br />
&nbsp;&nbsp;&nbsp; {<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; _str = strReplace(_str, &quot;&quot;&quot;, &quot;&quot;&quot;&quot;);<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return &quot;&quot;&quot; + _str + &quot;&quot;&quot;;<br />
&nbsp;&nbsp;&nbsp; }<br />
&nbsp;&nbsp;&nbsp; ;<br />
<br />
&nbsp;&nbsp;&nbsp; textFile = new TextIO(&quot;c:\temp\csv_test.csv&quot;,&quot;W&quot;,0);<br />
&nbsp;&nbsp;&nbsp; textFile.outFieldDelimiter(&quot;;&quot;);<br />
&nbsp;&nbsp;&nbsp; textFile.outRecordDelimiter(num2char(10));&nbsp; // Wichtig wegen Zeilenumbr&uuml;chen!!!<br />
<br />
<br />
&nbsp;&nbsp;&nbsp; while select CustTable<br />
&nbsp;&nbsp;&nbsp; {<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; textFile.write(<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; csv(CustTable.Name) +<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &quot;;&quot; +<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; csv(CustTable.Address) +<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &quot;;&quot;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; );<br />
&nbsp;&nbsp;&nbsp; }<br />
&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp; textFile = null;<br />
}
</div>]]></description>
<category>Microsoft Dynamics AX (Axapta)</category>
<pubDate>Mon, 10 Mar 2008 13:04:00 +0100</pubDate>
<link>https://www.schweda.net/blog_ax.php?bid=202</link>
<comments>https://www.schweda.net/blog_ax.php?bid=202</comments>
<guid isPermaLink="true">https://www.schweda.net/blog_ax.php?bid=202</guid>
<author>heinz.schweda@schweda.net (Heinz Schweda)</author>
<wfw:commentRss>https://www.schweda.net/blog_ax.php?bid=202</wfw:commentRss>
</item>
</channel>
</rss>	
