Question
Wells Fargo
US
Last activity: 12 Mar 2018 9:56 EDT
Need to set the value of a property to another property's value
I need to set the value of a property to another property's value. for example, In the UI user will enter XYZ in one field and 123 in another field. then we have to assign 123 to XYZ and it need to be stored in work table. When workitem is loaded it has to show, XYZ=123 in the clipboard.
-
Like (0)
-
Share this page Facebook Twitter LinkedIn Email Copying... Copied!
Accepted Solution
Pegasystems Inc.
US
Hi Rakesh,
Based on your requirement i had tried a sample use case to achieve your requirement and sharing over here, you can have a look and confirm me.
Regards
Mahesh
EPAM Systems, Inc.
ES
Hi Rakesh,
Thanks for posting on PSC.
You can leverage feature of Declare Expression of Pega for the same,
Refer it for details:-https://community.pega.com/sites/default/files/help_v722/procomhelpmain.htm
Navigate to links provided in blue color having detailed configuration information about each tab.
Hope it helps you in your business requirements, kindly notify by marking this post as answered/helpful for tracking purpose.
Regards,
Asif
EPAM Systems, Inc.
ES
Additional information:-
- https://collaborate.pega.com/discussion/declare-expression
- https://myknowpega.com/2017/05/17/declare-expressions/
-
Wells Fargo
US
Hi Asif, Thank you for the reply. But Declare expression wont suit here. we have to set the value of property to value of another property. example as below.
you have two fields in UI(field1, field2) and you entered field1="EmpName" and field2="Mahesh". Now on click of button it should be like .EmpName with value "Mahesh"
Pegasystems Inc.
US
Hi Rakesh,
If i understand your requirement correctly, you have two fields in UI(field1, field2) and you entered field1="EmpName" and field2="Mahesh". Now on click of button it should create property called .EmpName with value "Mahesh" in the current work object where you entered the field values in UI.
Note: If creation of the property is your requirement based on the user provided values from the UI, then it is not possible as the creation of new property is totally responsible by Engine specific API.
Hope this answers your query.
Regards
Mahesh
Wells Fargo
US
Hi Mahesh, Thank you. Here I am not creating property. consider that .EmpName already exists, so we have to set like .EmpName = Mahesh. Any approach that we can achieve this?
Accepted Solution
Pegasystems Inc.
US
Hi Rakesh,
Based on your requirement i had tried a sample use case to achieve your requirement and sharing over here, you can have a look and confirm me.
Regards
Mahesh
-
Bikash Nayak
Wells Fargo
US
Hi Mahesh, Thank you. Last two steps in Java (provided by you) helped me, I was also writing Java. Thanks Lot again. :) .Instead of last two steps , I have given myStepPage.putString(PropertyToBeSet,PropertyValue);...even this is also working
Pegasystems Inc.
US
Yes there are multiple ways to set the clipboard property value, our intention is to set the value of the clipboard property.
Wells Fargo
US
Hi Mahesh, Is there a way that we check if EmpName exists on the clipboard page (WorkPage)? If it exists, then only we need to set the value of EmpName.
I want to update EmpName for existing work item, so I have done Obj-open-by-handle and open the workitem and saved the workitem details on step page-workpage. So I have to check on WorkPage if the EmpName exists or not.
Pegasystems Inc.
US
You can have a look into @baseclass.PropertyExistsAndHasValue function alias or Utilities.PropertyHasValue(PublicAPI tools,String strReference) function.
Wells Fargo
US
ClipboardPage stepPage = tools.getStepPage();
String propName = stepPage.getString("PropertyName");
String propValue = stepPage.getString("PropertyValue");
after the first 3 steps , we have to check if the value of propname exists on the clipboard page as a property, then we have set as below 2 java steps.
ClipboardProperty cbProperty = stepPage.getProperty(propName);
cbProperty.setValue(propValueHi Mahesh, My exact requirement is mentioned below . You have provided me the code below .
In this example, value of propName is "EmpName". In java code, I am trying to use like getpropertyifexists. I cannot use- Empcode directly , since it is the value of propName. Why I am doing this , Instead of entering EmpName, there is a chance where users can enter like empname or EMPNAME or EMpNAME1 in the field1. it is setting as like EMpName1 = Mahesh. But it should always set EmpName = Mahesh. In our case, in the clipboard page EmpName property exists on the Page, we have to compare the value entered by user in field1 with the clipboard property name. ProperrtyExistsandhasvalue or propertyhas value are not working.
Pegasystems Inc.
US
I am bit confused with your requirement could you elaborate it with a sample example so that i can help you further on this issue. By the way empname or EMPNAME can be the same property names but EMpNAME1 is not equal to empname or EMPNAME property name.
Wells Fargo
US
Hi Mahesh, here I am providing the example- in user portal, I am providing 3 fields to the users. All fields are text inputs.I have created 3 properties under data-Portal class. first property is - WorkitemID and second property is PropertyName third property is PropertyValue. I have referred these three properties to 3 textinput fields.
Here, when user enter values in the fields, then these values will be under the context of Data-Portal class.
Now first User enters case Id in WorkItem field. By passing WorkItemID value as parameter to Obj-by-Handle method, I have loaded pyWorkPage of that workitem in activity.
User then enters value in PropertyName field, for example EmpName. So for the Property- PropertyName contains value as EmpName.
Then User enter, PropertyValue field, for example Mahesh. So for the Property -PropertyValue contains value as Mahesh.
pyLanding is the default page provided by PEGA for Data-Portal class in this context. So when we open the pyLanding Page, we have properties and their values are like below.
PropertyName = EmpName
PropertyValue = Mahesh
Hi Mahesh, here I am providing the example- in user portal, I am providing 3 fields to the users. All fields are text inputs.I have created 3 properties under data-Portal class. first property is - WorkitemID and second property is PropertyName third property is PropertyValue. I have referred these three properties to 3 textinput fields.
Here, when user enter values in the fields, then these values will be under the context of Data-Portal class.
Now first User enters case Id in WorkItem field. By passing WorkItemID value as parameter to Obj-by-Handle method, I have loaded pyWorkPage of that workitem in activity.
User then enters value in PropertyName field, for example EmpName. So for the Property- PropertyName contains value as EmpName.
Then User enter, PropertyValue field, for example Mahesh. So for the Property -PropertyValue contains value as Mahesh.
pyLanding is the default page provided by PEGA for Data-Portal class in this context. So when we open the pyLanding Page, we have properties and their values are like below.
PropertyName = EmpName
PropertyValue = Mahesh
Now , we have to set EmpName = Mahesh on the pyWorkPage of Workitem (not on pyLanding page) and this has been achieved. But, before setting this, we have to check whether EmpName exists as property or not on the pyWorkpage. Here, we may thought to use functions like-Propertyexists or Propertyexistsandhasvalue. If we use this functions, then to this functions I have pass input as "PropertyName " but not "EmpName" since actual property is -PropertyName and its value is EmpName. But in My case, I have to check VALUE of PropertyName exists as a Property on the pyWorkpage but not pyLanding Page. Please let me know if any confusion exists, Thank you.
Wells Fargo
US
Hi Mahesh, Thank you for the support. I have copied the value of PropertyName to Parameter and pass that parameter to the function proprtyexists(). Its working.Thanks Again.
It would be helpful for me if there is any solution for my query- Need to show the Pages under pyWorkPage in dropdown in UI.
Pegasystems Inc.
US
You don't need to copy the PropertyName value to Parameter and pass that parameter to the function PropertyExists(String), you can directly pass the @PropertyExists(.PropertyName) with step page as pyWorkPage. In this case it will check for the existence of .EmpName property in pyWorkPage as the function will take the value of .PropertyName i.e. EmpName which has been shown in my activity WHEN condition.
Wells Fargo
US
Hi Mahesh, can you provide suggestion for my requirement mentioned below
I have 4 fields on the screen. First field is test input field where User enter the Workitem ID. once user enters the workitemID, by using obj-open by handle, I am loading the pyWorkPage.
Second field is dropdown. Now, in the second field, I need to display the pages or pagelists/pagegroups present under pyWorkpage in dropdown.
Third filed is drop down. If user selects the pagelist or pagegroup in second field, then pages present under that pagelist or pagegroup need to be displayed in third field as dropdown.
In the 4th field, I need to display the properties present in the page selected in the 3rd field.
If user selects page instead of pagelist in the second field, then I need to hide the third field and in the 4th field, I need to display the properties present in the page selected in the 2nd field.
Please let me know if any thoughts to implement this. I am searching to know where this pages/pagelists/pagegroup under pyWorkpage will be stored.
Thank you.
Wells Fargo
US
Hi Mahesh, Any help on this post-Need to show the Pages under pyWorkPage in dropdown in UI..Thank you