Print all data from an entity

0
Hi all, I’m new to mendix and I’m working on a little project, the main issue now is that I have 1000 data in an entity and i want to print it all to text file. But the maximum data in 1 text file is 400 data. So if there are 1000 data it will be 3 different files. How should i build it in microflow? Any help is appreciated. Thanks!
asked
2 answers
2

using java action to generate list of 1000 rows into filedocument and download it.

 

ByteArrayOutputStream baos = new ByteArrayOutputStream();

OutputStreamWriter writer = new OutputStreamWriter(baos);

 

try {

for (IMendixObject obj : entityList) {

 

String attributeValue = obj.getValue(getContext(), "MyEntity.MyAttribute").toString();

 

writer.write(attributeValue);

writer.write(System.lineSeparator());

 

}

writer.flush();

 

// Create a new FileDocument

FileDocument fileDocument = new FileDocument(getContext()); Core.storeFileDocumentContent(getContext(), fileDocument.getMendixObject(), baos.toByteArray());

 

return fileDocument;

answered
1

If CSV is a suitable format for your text file, then you could use the CSV module from the Marketplace as it should be able to handle larger volumes of data. You would then be able to output the data to a single file.

 

https://marketplace.mendix.com/link/component/108605

 

I hope this helps.

answered