How to get size of a specific page in bytes or KB using activity
Need to get size of a clipboard page using activity
Need to get size of a clipboard page using activity
To get the size of a specific page in bytes or KB using an activity in Pega, you can use the estimatePageDataSize
Java method. Here's a step-by-step guide:
Create a new Activity:
Add a Java Step:
Java
.Insert Java Code:
Use the following Java code to estimate the size of the page:
// Import necessary classes
import com.pega.pegarules.pub.clipboard.ClipboardPage;
import com.pega.pegarules.pub.clipboard.ClipboardProperty;
import com.pega.pegarules.pub.runtime.PublicAPI;
// Get the page you want to measure
ClipboardPage myPage = tools.getPage("YourPageName");
// Estimate the size of the page
long pageSize = tools.estimatePageDataSize(myPage);
// Convert size to KB
double pageSizeKB = pageSize / 1024.0;
// Log the size
oLog.infoForced("Page size in bytes: " + pageSize);
oLog.infoForced("Page size in KB: " + pageSizeKB);
Run the Activity:
To get the size of a specific page in bytes or KB using an activity in Pega, you can use the estimatePageDataSize
Java method. Here's a step-by-step guide:
Create a new Activity:
Add a Java Step:
Java
.Insert Java Code:
Use the following Java code to estimate the size of the page:
// Import necessary classes
import com.pega.pegarules.pub.clipboard.ClipboardPage;
import com.pega.pegarules.pub.clipboard.ClipboardProperty;
import com.pega.pegarules.pub.runtime.PublicAPI;
// Get the page you want to measure
ClipboardPage myPage = tools.getPage("YourPageName");
// Estimate the size of the page
long pageSize = tools.estimatePageDataSize(myPage);
// Convert size to KB
double pageSizeKB = pageSize / 1024.0;
// Log the size
oLog.infoForced("Page size in bytes: " + pageSize);
oLog.infoForced("Page size in KB: " + pageSizeKB);
Run the Activity:
This method will help you determine the size of a specific page in bytes and convert it to KB for easier readability
Hi Avinash , will try out the approach thank you for the response
Hello Avinash ,
I was trying to fetch the size of the page using below code , my page will initially will be in one of the parameters [Param.ClipboardPageName] of type page and mapping it into a string called ClipboardpageName. when trying to save the rule im getting an error as
Error :
The method estimatePageDataSize(String) is undefined for the type PublicAPI
Compile failed.
// Java Code
ParameterPage objParamPage = tools.getParameterPage();
String ClipboardPageName = objParamPage.getString("ClipboardPageName");
long size = tools.estimatePageDataSize(ClipboardPageName);
Is there any otherway to get size and i couldnt include import classes steps because its causing below issue
Syntax error on token "import", yield expected
Question
Question
Question Solved
Question Solved
Discussion
Question Solved
Question Solved
Question
Question Solved
Question
Pega Collaboration Center has detected you are using a browser which may prevent you from experiencing the site as intended. To improve your experience, please update your browser.