Closed
Use pyDefault to set a page list
Hi,
I would like to know how to use pyDefault (or even pySetFieldDefaults) in order to pass default values into a page list
Thank you
This content is closed to future replies and is no longer being maintained or updated.
Links may no longer function. If you have a similar request, please write a new post.
Hi,
I would like to know how to use pyDefault (or even pySetFieldDefaults) in order to pass default values into a page list
Thank you
Hi,
pyDefault is the default Data Transform rule that it is invoked generally when the first instance of the class it is created to set the default values.
In the Page List scenario you have potentially two different pyDefault rules:
- Parent class which has a Page List child property.
- Child class which is the one defined in the Page List property.
For example a Computer has a list of Components. Computer.Components(). You could simply preset some components when the Computer class is created by using a pyDefault data transform like this:
In the context of Computer:
set .Components(1).Type="Video"
set .Components(2).Type="Storage"
set .Components(3).Type="Memory"
The problem doing it like this is that the Components class property pxObjClass won't be correctly set. The right way of doing it would be:
In the context of Computer:
update page .Components(1)
in the context of Components(1)
apply data transform pyDefault with parameter (ComponentType) set to "Video"
set .Type = Param.ComponentType
update page .Components(2)
in the context of Components(2)
apply data transform pyDefault with parameter (ComponentType) set to "Storage"
set .Type = Param.ComponentType
Hi,
pyDefault is the default Data Transform rule that it is invoked generally when the first instance of the class it is created to set the default values.
In the Page List scenario you have potentially two different pyDefault rules:
- Parent class which has a Page List child property.
- Child class which is the one defined in the Page List property.
For example a Computer has a list of Components. Computer.Components(). You could simply preset some components when the Computer class is created by using a pyDefault data transform like this:
In the context of Computer:
set .Components(1).Type="Video"
set .Components(2).Type="Storage"
set .Components(3).Type="Memory"
The problem doing it like this is that the Components class property pxObjClass won't be correctly set. The right way of doing it would be:
In the context of Computer:
update page .Components(1)
in the context of Components(1)
apply data transform pyDefault with parameter (ComponentType) set to "Video"
set .Type = Param.ComponentType
update page .Components(2)
in the context of Components(2)
apply data transform pyDefault with parameter (ComponentType) set to "Storage"
set .Type = Param.ComponentType
update page .Components(3)
in the context of Components(3)
apply data transform pyDefault with parameter (ComponentType) set to "Memory"
set .Type = Param.ComponentType
You could do similarly using Activity rules and using Page-New indicating the pyDefault data transform rule.
Regards,
Angel
You can either hardcode the index value and set pagelist(1).propname or use APPEND and set pagelist(<APPEND>).propname in the pyDefault Data Transform.
Question
Question
Question
Question
Question Solved
Question
Question
Question Solved
Question
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.