Hi, this is my scenario. Read txt file pycontents. I need to store the content of the txt to a clipboard property. Can anyone help me in implementing this?
I had written below java code but not working any experts pls help me
try{
String fileContents = myStepPage.getString("pyContents");
if(fileContents != null && fileContents.length() > 0)
{
byte[] fileBytes = java.util.Base64.getDecoder().decode(fileContents);
byte[] bytes = Base64Util.decodeToByteArray(fileContents);
String csvData = new String(bytes);
java.io.BufferedReader reader = new java.io.BufferedReader(new java.io.StringReader(csvData));
ClipboardProperty pyNote = tools.getStepPage().getProperty("bytes");
String thisLine = null;
while((thisLine = reader.readLine()) != null)
pyNote.add(thisLine );
reader.close();
}
}
catch (Exception e)
{
oLog.error("Exception in the CSVFile activity:",e);
throw new PRRuntimeException("Error during file conversion",e);
}
Getting below error
The page or property D_pxGetFile_pa2914482124897518pz.bytes is read-only, and cannot be modified. Calling method: com.pega.pegarules.data.internal.clipboard.ClipboardPropertyImpl.addToList(boolean, int, Object, boolean) Details: (none)