Discussion
3
Replies
1061
Views
Posted: July 7, 2015
Last activity: October 19, 2015
Closed
Dynamically setting pyDecimalPrecision
Hi All,
I have a field ( say SourceProperty) based on which the corresponding amount value ( say DestProp) needs to be formatted to 2 or 3 decimal places, i need to implement this on the same property, is there a way to dynamically set the pyDecimalPrecision value based on the other field selection value ? I am trying to set the precision value in the property control rule. but this doesnt work.... let me know if there is a work around for this !
Thank you
Hi,
I did it using Pega 7
use .setQualifier(String, String) if exists in 6.x
and your qualifier should be dynamic (not design-time) in the property. To make the qualifier dynamic, don't put any value in the field next to the qualifier name. Leave it blank. (This is from version 4.x)
Note: I am not using your DestPropVal property
<%
ClipboardProperty cp_active = tools.getActive();
ClipboardPage pg_parentPage = cp_active.getParentPage();
ClipboardProperty SourcePropertyRef = pg_parentPage.getProperty(".SourceProperty");
if(SourcePropertyRef.getStringValue().equals("true")) {
cp_active.setQualifier("pyDecimalPrecision", "2");
} else {
cp_active.setQualifier("pyDecimalPrecision", "3");
}
%>
Then if you want to submit the value you can fill in in the UI then add something like this:
<input type=text name="<pega:reference name='$this-name' />" id="<pega:reference name='$this-Definition(pyPropertyName)' mode='NORMAL'/>">
Tomorrow I will post another way of doing this "ish" using OOTB features. No coding.
Still in Pega 7
Damien
Pega self study support