0 votes
1.5k views
by (16.3k points)

1 Answer

0 votes
by (16.3k points)
 
Best answer
You can use the regular OOB Document upload control which binds to a DocumentInfo object, from this bound object you can get the content of the uploaded document as follows

Using Content Integration Pallete Item retrieve the contentStream by passing in the documentid which is available in the DocumentInfo Object

tw.local.BPMDocument[0].docId

The content stream can be processed as follows

var byteValue = Packages.java.lang.String(tw.local.contentStream.content).getBytes();

we need to base64 decode the content

var content = Packages.org.apache.commons.codec.binary.Base64.decodeBase64(byteValue);

tw.local.csvcontent = new java.lang.String(content, 'UTF-8');
you can try other encodings like UTF-16 or UTF32 also if the ccontent is not readable

after that you can split the csvcontent into a array of lines

var csvlines = tw.local.csvcontent.split("\n");

you can further split the individual lines based on a delimiter and then process them

Related questions

0 votes
0 answers 388 views
0 votes
1 answer 1.1k views
0 votes
1 answer 404 views
+1 vote
0 answers 1.2k views
0 votes
0 answers 643 views
0 votes
0 answers 251 views
0 votes
0 answers 542 views
0 votes
0 answers 270 views
0 votes
0 answers 274 views
0 votes
1 answer 1.2k views
0 votes
2 answers 2.7k views

634 questions

495 answers

97 comments

2.7k users

Join BPM Community Discord Channel

Welcome to BPM Tips Q&A, Community wiki/forum where you can ask questions and receive answers from other IBM BPM experts and members of the community. Users with 2000 points will automatically be promoted to expert level.
Created by Dosvak LLC
Our Youtube Channel
...