Discussion

To find attachement size

Hi All,

We have data file in pc_data_workattach, how do we programmtically find size of attachemtn in PEGA ? are there any out of box functionality avaialable ?

Thanks in advance for your help

**Moderation Team has archived post**

This post has been archived for educational purposes. Contents and links will no longer be updated. If you have the same/similar question, please write a new post.

Comments

Keep up to date on this post and subscribe to comments

October 16, 2012 - 7:02am

Thanks AUSTINJONNY. It works fine, I appreciate your help.

quote:


Originally posted by AUSTINJONNY

Below is the code,

String content = tools.findPage(tools.getParamValue("MsgPage")).getString(".Attachments.pyAttachValues(" + tools.getParamValue("pyForEachCount") + ")");//Getting pyAttachStream Stream
byte decodedBuffer [] = null;
decodedBuffer = content.getBytes();
byte res2[] = Base64Util.decode(decodedBuffer);
long conFileSize = res2.length/1024;

if (conFileSize < 1)
{
conFileSize = 1;
}
String FileSizeKB = Long.toString(conFileSize);

Thanks,
Austin Jonny.


October 16, 2012 - 9:40am

Welcome Bro :)

quote:


Originally posted by PEGAPRPC-7

Thanks AUSTINJONNY. It works fine, I appreciate your help.

quote:


Originally posted by AUSTINJONNY

Below is the code,

String content = tools.findPage(tools.getParamValue("MsgPage")).getString(".Attachments.pyAttachValues(" + tools.getParamValue("pyForEachCount") + ")");//Getting pyAttachStream Stream
byte decodedBuffer [] = null;
decodedBuffer = content.getBytes();
byte res2[] = Base64Util.decode(decodedBuffer);
long conFileSize = res2.length/1024;

if (conFileSize < 1)
{
conFileSize = 1;
}
String FileSizeKB = Long.toString(conFileSize);

Thanks,
Austin Jonny.



October 9, 2012 - 1:02pm

Below is the code,

String content = tools.findPage(tools.getParamValue("MsgPage")).getString(".Attachments.pyAttachValues(" + tools.getParamValue("pyForEachCount") + ")");//Getting pyAttachStream Stream
byte decodedBuffer [] = null;
decodedBuffer = content.getBytes();
byte res2[] = Base64Util.decode(decodedBuffer);
long conFileSize = res2.length/1024;

if (conFileSize < 1)
{
conFileSize = 1;
}
String FileSizeKB = Long.toString(conFileSize);

Thanks,
Austin Jonny.

February 5, 2013 - 7:17pm

That works.. Really helpful.

May 23, 2013 - 9:17am

Its really helpful

April 20, 2016 - 6:30am

Thanks a lot, its worked for me also.