删除默认的分隔符转换器
Remove default seperator mule transformer
我正在尝试将数据从 Salesforce 写入 CSV 文件。
我正在使用 Data Weave 转换器来转换数据,但默认情况下它使用“\”作为分隔符,导致我的 CSV 出现所有问题。
我的转换器代码很简单
%dw 1.0
%output application/csv
---
payload
是否有任何选项可以禁用“\”作为分隔符?
在 Dataweave 中,对于 CSV 转换,您可以配置一些选项:
Separator: separator character for parsing the values. default=','
Quote: quote character. default=" "
Escape: escape char for quotes. default=/
Header: When true, the header will be parsed and used as field names. default=true
如何配置?
%output application/csv header=true, separator=",", escape="/"
我认为您对 escape
默认值有疑问。你应该改变它。
Take a look to the documentation: https://docs.mulesoft.com/mule-user-guide/v/3.7/dataweave-reference-documentation#input-directive
默认的转义字符(转义引号的字符)是/。为了根据要求更改它,您必须:
转到 XML 编辑器,然后必须将它们设置为数据编织组件的子元素,如下例所示:
<dw:input-payload doc:sample="list_csv.csv" mimeType="text/csv" >
<dw:reader-property name="escape" value="|"/>
</dw:input-payload>
在这里,您可以根据需要设置 'escape' 的任何值,方法是相应地设置它的值。
我正在尝试将数据从 Salesforce 写入 CSV 文件。
我正在使用 Data Weave 转换器来转换数据,但默认情况下它使用“\”作为分隔符,导致我的 CSV 出现所有问题。
我的转换器代码很简单
%dw 1.0
%output application/csv
---
payload
是否有任何选项可以禁用“\”作为分隔符?
在 Dataweave 中,对于 CSV 转换,您可以配置一些选项:
Separator: separator character for parsing the values.
default=','
Quote: quote character.
default=" "
Escape: escape char for quotes.
default=/
Header: When true, the header will be parsed and used as field names.
default=true
如何配置?
%output application/csv header=true, separator=",", escape="/"
我认为您对 escape
默认值有疑问。你应该改变它。
Take a look to the documentation: https://docs.mulesoft.com/mule-user-guide/v/3.7/dataweave-reference-documentation#input-directive
默认的转义字符(转义引号的字符)是/。为了根据要求更改它,您必须:
转到 XML 编辑器,然后必须将它们设置为数据编织组件的子元素,如下例所示:
<dw:input-payload doc:sample="list_csv.csv" mimeType="text/csv" >
<dw:reader-property name="escape" value="|"/>
</dw:input-payload>
在这里,您可以根据需要设置 'escape' 的任何值,方法是相应地设置它的值。