Question
Csc
IN
Last activity: 17 Aug 2016 6:54 EDT
How to restrict maximum number of files that can be dragged and Dropped into the control(pzmultidraganddropcontrol)?
int i;
ClipboardPage pgDD = null;
pgDD = tools.findPage( "dragDropFileUpload" );
i = pgDD.getProperty( "pxResults" ).size();
Message was edited by: Attached Document is the Complete Code Snippet for the Control
-
Like (0)
-
Share this page Facebook Twitter LinkedIn Email Copying... Copied!
Accepted Solution
Pegasystems Inc.
IN
Hi Ashok, Good Morning!
- so, I learn it as ... at one go, drag & drop of attachments should be within a limit...
- is the limit configured on number of attachments user drag & drop? or on the size of attachment?
- we could attach a very less size files up to 100 & ONE file in GB of size...(an edge case, sorry)
- to limit attachment size...
- In 7x please refer OOTB system setting RULE-ADMIN-SYSTEM-SETTINGS PEGA-PROCESSENGINE PYMAXDRAGDROPATTACHSIZEMB #20140801T111621.066 GMT
- prior 7x, by default, file attachments are restricted to 25 megabytes in size.
- We can set a larger or smaller limit with the prconfig.xml file setting
- <env name="Initialization/MaximumFileUploadSizeMB" value="nn" />
- where nn is the size in megabytes
- <env name="Initialization/MaximumFileUploadSizeMB" value="nn" />
- We can set a larger or smaller limit with the prconfig.xml file setting
- prior 7x, by default, file attachments are restricted to 25 megabytes in size.
- In 7x please refer OOTB system setting RULE-ADMIN-SYSTEM-SETTINGS PEGA-PROCESSENGINE PYMAXDRAGDROPATTACHSIZEMB #20140801T111621.066 GMT
- to limit # attachments... we could do a property-set-message
- add Page-Set-Messages if @(Pega-RULES:Utilities).LengthOfPageList(dragDropFileUpload.pxResults)>5 in activity pyUploadFile in class Data-WorkAttach-File
- UI should also be customized to include @baseclass.DisplayErrors on upload file dialog, though.
- if this works, we could attempt for a wrapper activity calling pyUploadFile followed by custom validation activity.
- UI should also be customized to include @baseclass.DisplayErrors on upload file dialog, though.
- add Page-Set-Messages if @(Pega-RULES:Utilities).LengthOfPageList(dragDropFileUpload.pxResults)>5 in activity pyUploadFile in class Data-WorkAttach-File
- for both the use cases, it would be nice to prompt user with an information text on load of attachments.screen
Please share your thoughts/comments, Thank you!
Hi Ashok, Good Morning!
- so, I learn it as ... at one go, drag & drop of attachments should be within a limit...
- is the limit configured on number of attachments user drag & drop? or on the size of attachment?
- we could attach a very less size files up to 100 & ONE file in GB of size...(an edge case, sorry)
- to limit attachment size...
- In 7x please refer OOTB system setting RULE-ADMIN-SYSTEM-SETTINGS PEGA-PROCESSENGINE PYMAXDRAGDROPATTACHSIZEMB #20140801T111621.066 GMT
- prior 7x, by default, file attachments are restricted to 25 megabytes in size.
- We can set a larger or smaller limit with the prconfig.xml file setting
- <env name="Initialization/MaximumFileUploadSizeMB" value="nn" />
- where nn is the size in megabytes
- <env name="Initialization/MaximumFileUploadSizeMB" value="nn" />
- We can set a larger or smaller limit with the prconfig.xml file setting
- prior 7x, by default, file attachments are restricted to 25 megabytes in size.
- In 7x please refer OOTB system setting RULE-ADMIN-SYSTEM-SETTINGS PEGA-PROCESSENGINE PYMAXDRAGDROPATTACHSIZEMB #20140801T111621.066 GMT
- to limit # attachments... we could do a property-set-message
- add Page-Set-Messages if @(Pega-RULES:Utilities).LengthOfPageList(dragDropFileUpload.pxResults)>5 in activity pyUploadFile in class Data-WorkAttach-File
- UI should also be customized to include @baseclass.DisplayErrors on upload file dialog, though.
- if this works, we could attempt for a wrapper activity calling pyUploadFile followed by custom validation activity.
- UI should also be customized to include @baseclass.DisplayErrors on upload file dialog, though.
- add Page-Set-Messages if @(Pega-RULES:Utilities).LengthOfPageList(dragDropFileUpload.pxResults)>5 in activity pyUploadFile in class Data-WorkAttach-File
- for both the use cases, it would be nice to prompt user with an information text on load of attachments.screen
Please share your thoughts/comments, Thank you!
psahukaru
Pegasystems Inc.
IN
The code looks fine to me. It should retrieve the number of documents in pipeline (uploaded) but not yet attached (saved to db).
What is the expected 'correct value'? The number in pipeline or number of actual attachments.
Csc
IN
Its the Number in PipeLine
Computer Sciences Corporation
IN
Hi Vikas, , we are looking for number in pipeline
Need to get the size the of the pagelist from the control do determine the No of files that are already dragged into the dropdown
In this case , "i" should return 2, but it always returns zero.
Ideally the Below code should work when called from the section as well, but this is not working ., Need to check for alternatives
The same code is working fine from an SaveAllattachments OOTB activity.
Pegasystems
US
If you're always getting 0, my guess is one of two things: Either you're looking at a different property than the one that gets actually updated, or you're looking at the right property but there hasn't yet been a round-trip to the server so the property hasn't been updated yet.
To check for the first guess , try examining the entire page before and after, and compare, to see what properties are getting updated, if not the one you expected.
To check for the second guess, record using fiddler to see when the actual round-trip to the server takes place. /Eric
Computer Sciences Corporation
IN
Hi Eric,
As per your suggestion, I've checked Fiddler and see that server round trips are indeed happening and we are referring to the correct property.
Unlike other code-pega-list pagelists , drapdropFileUpload does not have a pxResultCount property , is this the reason for not getting the size??
This Clipboard page in generated by OOTB pega rules.
Pegasystems Inc.
IN
would it be convincing to work-a-round as below...
- add Page-Set-Messages if @(Pega-RULES:Utilities).LengthOfPageList(dragDropFileUpload.pxResults)>5 in activity pyUploadFile in class Data-WorkAttach-File
- UI should also be customized to include @baseclass.DisplayErrors on upload file dialog, though.
- disable add attachments feature if @(Pega-RULES:Utilities).LengthOfPageList(AllAttachments.pxResults)>5
Please share your thoughts/comments, Thank you!
psahukaru
Computer Sciences Corporation
IN
Hi Phani,
This will not solve our purpose, Our idea is not to restrict the number of attachements that are allowed for a work object,
The idea is just to limit the no of attachments being dragged and dropped into the control at a time ,
Since if the user drops 100 files at a time with huge size then it out take lot of clipboard size and lead to OOM exceptions and at times bringing down the JVMs.
In order to avoid this we wanted to put a restriction, on the number of file that can be uploaded at one single go.
Accepted Solution
Pegasystems Inc.
IN
Hi Ashok, Good Morning!
- so, I learn it as ... at one go, drag & drop of attachments should be within a limit...
- is the limit configured on number of attachments user drag & drop? or on the size of attachment?
- we could attach a very less size files up to 100 & ONE file in GB of size...(an edge case, sorry)
- to limit attachment size...
- In 7x please refer OOTB system setting RULE-ADMIN-SYSTEM-SETTINGS PEGA-PROCESSENGINE PYMAXDRAGDROPATTACHSIZEMB #20140801T111621.066 GMT
- prior 7x, by default, file attachments are restricted to 25 megabytes in size.
- We can set a larger or smaller limit with the prconfig.xml file setting
- <env name="Initialization/MaximumFileUploadSizeMB" value="nn" />
- where nn is the size in megabytes
- <env name="Initialization/MaximumFileUploadSizeMB" value="nn" />
- We can set a larger or smaller limit with the prconfig.xml file setting
- prior 7x, by default, file attachments are restricted to 25 megabytes in size.
- In 7x please refer OOTB system setting RULE-ADMIN-SYSTEM-SETTINGS PEGA-PROCESSENGINE PYMAXDRAGDROPATTACHSIZEMB #20140801T111621.066 GMT
- to limit # attachments... we could do a property-set-message
- add Page-Set-Messages if @(Pega-RULES:Utilities).LengthOfPageList(dragDropFileUpload.pxResults)>5 in activity pyUploadFile in class Data-WorkAttach-File
- UI should also be customized to include @baseclass.DisplayErrors on upload file dialog, though.
- if this works, we could attempt for a wrapper activity calling pyUploadFile followed by custom validation activity.
- UI should also be customized to include @baseclass.DisplayErrors on upload file dialog, though.
- add Page-Set-Messages if @(Pega-RULES:Utilities).LengthOfPageList(dragDropFileUpload.pxResults)>5 in activity pyUploadFile in class Data-WorkAttach-File
- for both the use cases, it would be nice to prompt user with an information text on load of attachments.screen
Please share your thoughts/comments, Thank you!
Hi Ashok, Good Morning!
- so, I learn it as ... at one go, drag & drop of attachments should be within a limit...
- is the limit configured on number of attachments user drag & drop? or on the size of attachment?
- we could attach a very less size files up to 100 & ONE file in GB of size...(an edge case, sorry)
- to limit attachment size...
- In 7x please refer OOTB system setting RULE-ADMIN-SYSTEM-SETTINGS PEGA-PROCESSENGINE PYMAXDRAGDROPATTACHSIZEMB #20140801T111621.066 GMT
- prior 7x, by default, file attachments are restricted to 25 megabytes in size.
- We can set a larger or smaller limit with the prconfig.xml file setting
- <env name="Initialization/MaximumFileUploadSizeMB" value="nn" />
- where nn is the size in megabytes
- <env name="Initialization/MaximumFileUploadSizeMB" value="nn" />
- We can set a larger or smaller limit with the prconfig.xml file setting
- prior 7x, by default, file attachments are restricted to 25 megabytes in size.
- In 7x please refer OOTB system setting RULE-ADMIN-SYSTEM-SETTINGS PEGA-PROCESSENGINE PYMAXDRAGDROPATTACHSIZEMB #20140801T111621.066 GMT
- to limit # attachments... we could do a property-set-message
- add Page-Set-Messages if @(Pega-RULES:Utilities).LengthOfPageList(dragDropFileUpload.pxResults)>5 in activity pyUploadFile in class Data-WorkAttach-File
- UI should also be customized to include @baseclass.DisplayErrors on upload file dialog, though.
- if this works, we could attempt for a wrapper activity calling pyUploadFile followed by custom validation activity.
- UI should also be customized to include @baseclass.DisplayErrors on upload file dialog, though.
- add Page-Set-Messages if @(Pega-RULES:Utilities).LengthOfPageList(dragDropFileUpload.pxResults)>5 in activity pyUploadFile in class Data-WorkAttach-File
- for both the use cases, it would be nice to prompt user with an information text on load of attachments.screen
Please share your thoughts/comments, Thank you!
psahukaru
Computer Sciences Corporation
IN
Hi Phani,
we are on 6.3 SP1 and have already handled the maxfile size and type of files that are allowed.
I'm also able to handle the max no files by using a local variable i and increment it for each file ,
But wanted to get the count dynamically, so wanted to get the size of dragDropFileUpload
Attached the complete code that we are using on the Original parent post,
just do a private checkout of pzmultidraganddropcontrol rule and copy the code into the control and run it ,
Note : this a final rule , but we have customized it for our application
Virtusa
SG
This solved the issue. Thanks
Pegasystems
US
>>> drapdropFileUpload does not have a pxResultCount property , is this the reason for not getting the size??
Hmmm, I'm not sure if that's the reason. If you can put in a temporary on-change handler that tallies and supplies a .pxResultCount, (or maybe you can find a simpler way to supply a .pxResultCount) you can see if the issue goes away. Or, if you look at how your ".size" function works to see if it relies on .pxResultCount. Or just fill in .pxResultCount and call .size again to see whether it gives the correct answer. /Eric
Computer Sciences Corporation
IN
Thanks Eric , I will check on this and get back.
Pegasystems Inc.
IN
Created a test section and run the following and got output for all attachement page.
<%
int Result=0;
String strDDPageName = "AllAttachments";
ClipboardPage cpDrgDrpFU = tools.findPage( strDDPageName );
ClipboardProperty pResults = cpDrgDrpFU.getProperty( "pxResults" );
Result= pResults.size();
%>
<html>
<%= Result%>
</html>
It worked fine at my end.
Computer Sciences Corporation
IN
Hi Gaurav,
Yes, it is working for other Pagelists, but it is not working specifically for dragDropFileUpload