我有一个XML文件,我必须在CSV文件中转换然后附加到工作对象中?
我已经尝试过写一个活动并使用pxConvertResultsToCSV活动,然后尝试使用链接对象方法附加文件,但是这样所有结果都会出现在一行中。
答案 0 :(得分:0)
几乎没有步骤......
1)使用活动方法Apply-Parse-XML
解析XML。
您将在PageList
。
2)现在创建Rule-Obj-Html
规则。在代码部分创建表
<table border="1">
<pega:forEach name="YourPageListPage.PageList"> // --> the pagelist in which got the info from xml.
<tr>
<TD>
<pega:reference name="$THIS.COLUMN1"/> // --> property name
</TD>
<TD>
<pega:reference name="$THIS.COLUMN2"/> // --> property name 2
</TD>
</tr>
</pega:forEach>
</table>
3)现在使用Property-Set-HTML
在一些param变量中获取html规则的流(例如 param.pyFileData )
还要将一个局部变量创建为 strFileData 。
使用Java
步骤解码流。并使用此代码。
String atr = (String)tools.getParameterPage().getParameterValue("pyFileData");
byte[] byteArray=(byte[])atr.getBytes();
//encode the byte array into Base64.
strFileData = Base64Util.encodeToString(byteArray); // strFileData is local variable mentioned in activity.
4)现在创建一个类Data-WorkAttach-File
的页面,并在该页面上设置以下属性。
.pxRefObjectKey --> pzinskey of work object
.pxAttachKey --> any key, maybe current date time
.pyAttachStream --> your stream which you got from 3rd step (local.strFileData )
.pyNote --> any note
.pxAttachName --> "filename.csv"
休息我猜已经知道..
使用Obj-Save
5)使用Link-Objects
将附件页面附加到工作对象。
多数民众赞成。