Question
Tokio Marine Holdings
JP
Last activity: 4 Mar 2016 22:28 EST
How to get a value from database by Declare Expression
I would like to know how to get a value from database in Declare Expression.
For example,
I have 2 Properties ".ItemCode" and ".ItemName".
And I also have a database table that have the relationship between "ItemCode" and "ItemName".
When we input ".ItemCode", I would like ".ItemName" to be autocompleted.
I know how to get a value from database by Activity.
Can we get it by Declare Expression or another way?
-
Like (0)
-
Share this page Facebook Twitter LinkedIn Email Copying... Copied!
Pegasystems Inc.
IN
Hi
The component which will play a key role here is function .If you have a specific requirement which cant be fulfilled via any of the available function, then you need to write your own one and then refer that in the declare expression.
You may refer this help articles :
https://community.pega.com/sites/default/files/help_v72/procomhelpmain.htm
https://community.pega.com/sites/default/files/help_v72/procomhelpmain.htm studio/expressionbuilder/ref_functions.htm?Highlight=function
Pegasystems
US
If your item code and item name are both properties on the current work object, you needn't worry about the db, as the system will handle the following chores for you:
1) The properties will be pre-populated on your page from the latest values in the db.
2) If you use your declare-expression to update your item name when the item code has been changed, the db will be automatically updated when the work gets committed.
/Eric
Updated: 2 Mar 2016 12:25 EST
Process 360
IN
As Santanu Bhattacherjee suggested you may need to write a RUF , but if you are not good with java or custom code then you can create a DPage (with source as activity to retrieve the itemdesc) with ItemCode as parameter and refer it in the Declare Expression with change tracking as whenever used if no value present.
I am not sure whether this is the best way to do it.
Tokio Marine Holdings
JP
Hello Bhanu
It's easy for me to understand.
If the Linked Property don't fit for my requirement, I will choose this way.
Thank you very much.
Updated: 2 Mar 2016 20:12 EST
Infosys
AU
Linked Property could be a good fit for this type of requirement provided the database table having ItemCode and itemName is mapped to a class in Pega. This eliminates need of writing any activity/RUF.
Hope this helps!
Murali...
Coforge DPA
IN
Hey,
Just use the Linked Property opton,Define the ItemDescription source as the Linked Property ,than write a data page to fetch the value of the ItemDesc by inputing the item code.
It will resolve ur need.
Tokio Marine Holdings
JP
Hello Prathap
Thank you for your advice.
I read this article, but I still don't understand how to use the Linked Property.
https://docs-previous.pega.com/use-linked-properties-display-data-related-objects
Could you please give me more details?
Pegasystems
US
I've used reference-properties but not linked-properties. Are they similar ? If so, what are the main differences, or advantages to using one over the other ? /Eric
Infosys
AU
Hi Eric,
Reference properties and Linked properties are not similar. In simple terms:
Reference properties are used to avoid duplicating same information across multiple places/pages
Linked properties are used to declaratively load the data (linked through a key) instead of writing additional code (activity or data page or others)
Following topics on Pega Academy has these concepts covered in details:
Reference Properties - Under 'Data Model' unit in LSA (6.2) course
Linked Properties - Under 'Data Model' unit in SSA (6.2) course
Hope this helps you.
Murali...