Discussion
Accenture
US
Last activity: 29 Nov 2016 2:42 EST
JSP Tags - Access a clipboard property using PEGA Engine API
I need help with finding or accessing a property on a clipboard page using JSP tags from a control.
I have a property (P) and a control associated with that property. The control gadget has JSP tags in the HTML tab of the control which display the value to a user on a portal.
I can access the Property (P) inside of my control using String strPropP = tools.getActiveValue();
My requirement is to gather another property from the same class and same clipboard page and then need to compare this Property (P) which i can access and display the result of the comparison.
How can I access another property Q on the clipboard page from within this control?
I tried several methods including
String strPropQ = tools.getActive().getProperty("Q").getStringValue();
Code compiles withour error but fails at runtime.
It fails because I am unable to GET the property Q from the clipboard.
Any ideas on how to access and/or retrieve a clipboard property
1. by using the tools. API and/or
2. from within a control gadget.
-
Like (0)
-
Share this page Facebook Twitter LinkedIn Email Copying... Copied!
NIIT Technologies Limited
AU
Below code might help:
ClipboardPage page = tools.findPage("YourClipboardPageName");
String strPropQ = page.getString("Q");
Also,check ClipboardAPI from PegaHelp ==> APIs ==> EngineAPIs
Coforge Limited
AU
Hi,
I have a similar requirement but reverse, here I need to set the clipboard property to TRUE/FALSE using JSP tags from Control Rule Form.Could you help me on this.
Thanks
NIIT Technologies Limited
AU
To set a property value:
ClipboardPage page = tools.findPage("YourClipboardPageName");
page.putString("PropertyName","true");
Coforge Limited
AU
Thanks, that helped me.
Could u please help me in below issue also.....
I have a multiselectlist with constant values that allow users to select multiple values (should press CTRL for multiple selections)
<select id="Cars" name="Brands" multiple >
<option value="all">All</option>
<option value="volvo">Volvo</option>
<option value="saab">Saab</option>
<option value="opel">Opel</option>
<option value="audi">Audi</option>
</select>
Now if particular item is clicked/selected then i have to set a clipboard page property, this should happen for multiple values also. If user selects two elements in list, I have to set two properties in clipbaord.
Could you please help me.Thanks
NIIT Technologies Limited
AU
Yes, it will work.
You can also use:
page.getProperty("PropertyName").setValue("true");
Coforge Limited
AU
Thanks, that helped me.
Could u please help me in below issue also.....
I have a multiselectlist with constant values that allow users to select multiple values (should press CTRL for multiple selections)
<select id="Cars" name="Brands" multiple >
<option value="all">All</option>
<option value="volvo">Volvo</option>
<option value="saab">Saab</option>
<option value="opel">Opel</option>
<option value="audi">Audi</option>
</select>
Now if particular item is clicked/selected then i have to set a clipboard page property, this should happen for multiple values also. If user selects two elements in list, I have to set two properties in clipbaord.
Could you please help me.Thanks
Coforge Limited
AU
Hi Ravi,
Waiting for your reply.Thanks.
NIIT Technologies Limited
AU
Hi,
Execute a javascript function onClick of <Option> tag.
Then, you can use JSP scriplets to set properties.
Also,
In JavaScript function, you can call an activity to set properties using below code.
var setPropURL = new URL([ClassName.ActivityName]);
var paramData = new URL();
paramData.put("ParamPropertyName","Value");
var callback;
var request = pega.util.connect.asyncRequest('POST', setPropURL.toURL(),callback,paramData.toEncodedPostBody());
Coforge Limited
AU
Hi,
Thanks for useful reply.
Could please tell me JSP scriplets to set properties.
Updated: 8 Jun 2015 13:37 EDT
Coforge
US
Assuming clipboard page is MyPage which has the two properties A and B. Value of A needs to be copied to value of B.
<%
tools.findPage("MyPage").putString(".B", tools.findPage("MyPage").getString(".A"));
%>
Accenture
US
Thanks.
I was able to access any clipboard page including declare pages by passing the name of that particular page in the findPage method.
ClipboardPage page = tools.findPage("YourClipboardPageName");
Coforge Limited
AU
Thanks Ravi and all, I have achieved my requirement.
I have an another problem, Sure you guys Could help me.
prob: Copying around 50 individual properties from pyWorkPage to a new Pagelist (if not possible to a page)....
I have seen an OOTB activity (copywork). I see the java code in step-2 is what all i need.But i didnt understand how to implement that code for my requirment.Could u guys help me.
Thanks Ravi and all, I have achieved my requirement.
I have an another problem, Sure you guys Could help me.
prob: Copying around 50 individual properties from pyWorkPage to a new Pagelist (if not possible to a page)....
I have seen an OOTB activity (copywork). I see the java code in step-2 is what all i need.But i didnt understand how to implement that code for my requirment.Could u guys help me.
java.util.Set propertySet = myStepPage.keySet();
java.util.Iterator iter_properties = propertySet.iterator();
ClipboardPage primaryPage = tools.getPrimaryPage();
String strPropertyName;
ClipboardProperty cp_property;
while(iter_properties.hasNext()){
strPropertyName= (String)iter_properties.next();
if(!(strPropertyName.startsWith("px")||strPropertyName.startsWith("pz"))){
cp_property = myStepPage.getProperty(strPropertyName);
cp_property.setValue(primaryPage.getProperty(strPropertyName));
}
}
Thanks
Venkat
NIIT Technologies Limited
AU
1) Create a data transform to copy properties from pyWorkPage to your new page
2) Create an activity with Apply-DataTransform step
3) Execute activity from JSP using below code
HashStringMap hmActivityKeys = new HashStringMap();
hmActivityKeys .putString("pxObjClass", "Rule-Obj-Activity");
hmActivityKeys .putString("pyClassName", "[Applies-To-Class of Activity]");
hmActivityKeys .putString("pyActivityName", "[ActivityName]");
ParameterPage newParamsPage = new ParameterPage();
newParamsPage.putString("[ParamName]", "[ParamValue]");
tools.doActivity(hmActivityKeys , targetPage, newParamsPage);
NIIT Technologies Limited
AU
Also, have a look at tools.doAction() API which might allow you to call data transform directly from JSP code.
Coforge Limited
AU
Thanks Ravi, It worked for me , U r really awesome.
Can u please tell me how a list to list works....what are the prerequisites to implement a list to list control....can u please explain me in detail.
Thanks
Venkat
Coforge Limited
AU
I was unable to populate mu pagelist values in ListToList Control, I see the list in clipboard and values too , but with classless mentioned....is that a problem.
Please Help me.
Thanks
Venkat
Wipro
IN
<%
tools.findPage("MyPage").putString(".newvalue", tools.findPage("MyPage").getString(".q"));
%>
Capgemini
IN
how to refernce property in html control as hidden and set the same from js variable?.
example:
<script>
fction tst(){
var a="abd"
document.all.hidd.value=a;
}
</script>
<textarea id="hidd" ></textarea>
i need to reference pega property in hidden txtarea.so that i can set in js function.
Morgan Stanley
IN
hi,
how to reference value list properties from clipboard in jsp.
TCS
IN
Hi , I have a similar requirement of getting a clipboard value into a JavaScript variable.
Am setting a variable in script like -
var e1 = '<%= tools.findPage("Clipboardpage").getString("propertyname") %>';
Have set an alert now to see what value is e1 holding and found it as - <%=tools.findPage("Clipboardpage").getString("propertyname") %>
instead of value from clipboard.
Can you please tell me what i have to correct in the assigning step so as to get the expected value from clipboard.
Any suggestions would be much appreciated.Thanks in advance.