Discussion
Wipro
IN
Last activity: 24 Jun 2015 9:36 EDT
Need Help
In Pega7, How to auto generate the primary key value(with out displaying the field in UI)?
-
Like (0)
-
Share this page Facebook Twitter LinkedIn Email Copying... Copied!
Pegasystems Inc.
US
Since you've posted this question within the System Archtitect Essentials I course forum, I'm going to take a wild guess that by "primary key value" you are referring to the Case ID (.pyID) property found in the case header.
First thing to note is that the Case ID is automatically generated the moment the case is created, regardless of the UI. The Case Header is simply displaying the property value for .pyID.
The Case Header is one of the many sections referenced in the standard Perform harness rule record.
You can use the UI inspector, hover over the case ID (e.g. "C-14") and open the standard section rule record named pyCaseHeader.
Create a copy of this rule into you application RuleSet: Click on Save As, and when the SaveAs dialog appears, don't change the name of the rule or the AppliesTo class reference (leave as Work-), simply change RuleSet reference to something in your application (e.g. HRServices:01-01-01).
Delete the cell that references .pyID, Save your new rule, and test by creating an new case. You will no longer see the reference in the header, but if you use the Clipboard viewer, and review the contents of pyWorkPage, you will see that the .pyID property has been intantiated and has value (e.g. "C-14).
Since you've posted this question within the System Archtitect Essentials I course forum, I'm going to take a wild guess that by "primary key value" you are referring to the Case ID (.pyID) property found in the case header.
First thing to note is that the Case ID is automatically generated the moment the case is created, regardless of the UI. The Case Header is simply displaying the property value for .pyID.
The Case Header is one of the many sections referenced in the standard Perform harness rule record.
You can use the UI inspector, hover over the case ID (e.g. "C-14") and open the standard section rule record named pyCaseHeader.
Create a copy of this rule into you application RuleSet: Click on Save As, and when the SaveAs dialog appears, don't change the name of the rule or the AppliesTo class reference (leave as Work-), simply change RuleSet reference to something in your application (e.g. HRServices:01-01-01).
Delete the cell that references .pyID, Save your new rule, and test by creating an new case. You will no longer see the reference in the header, but if you use the Clipboard viewer, and review the contents of pyWorkPage, you will see that the .pyID property has been intantiated and has value (e.g. "C-14).
Below are screenshots of this process, although references exact RuleSet is different - in your case for SAE I course, I'd place the new pyCaseHeader section in HRServices ruleset:
Hope this helps,
Bob Lloyd
PDN/Pega Academy Forums Support Team
Wipro
IN
Thank you. How can I save this caseID as a primary key value in my Data Table? should I mention this in a property-set(activity) or in section itself( Text Input->General->properties as pyWorkPage.pyID)?
Pegasystems Inc.
US
NandhiniV8290,
There seems to be some confusion. Based on your response I would conclude my first reply is not what you are looking for. "Primary Key" in a Data Table is a completely different subject than Case ID, so my previous assumption was incorrect.
Data Table (Pega versions 7.1.6 and prior) are essentialy just Data Classes which define certain properties that will be used as columns for a table-like construct. Here is the Developer Help definition: https://community.pega.com/sites/default/files/help_v71/procomhelpmain.htm
When you use the Data Table wizard, you are creating a data class, a few other rules used to create the table construct, and the properties you want to be the columns of that table. The architect creating the Data Table identifies which property (to be created by the wizard) will be the primary key for accessing that table later. Here is a link to Developer Help information on Data Tables in 7.1.6: https://community.pega.com/sites/default/files/help_v71/procomhelpmain.htm
Can you please let us know which System Architect Essentials I exercise you are working out so we can provide a better answer?
Thank you.
Bob Lloyd
PDN/Pega Academy Forums Support Team
Wipro
IN
Thank you for your suggestions. I'm working with my own app "Job Portal". In this case, I wanted to store my CaseId as a primary key value in Data Table.
Pegasystems Inc.
US
Because your question involves a design question, it requires a more nuanced answer. Based on your particular example I suggest that you consider reaching out to Pega Consulting http://www.pega.com/services/consulting for further assistance.
The particular forum you have posted in is dedicated to Pega Academy, System Architect Essentials I (7.1.6) course topics only.
Typically, Data Tables (Pega 7.1.6) are created for the purpose of storing small sets of read-only data that does not change or need to be updated frequently.
IMPORTANT UPGRADE NOTE: In Pega 7.1.7 and forward, Data tables have been replaced by a new local data storage format. You can upgrade old-style data tables to use the new local data storage format, but the new format is not compatible with earlier versions of Pega 7 in which data tables could be created.
You can still edit legacy data tables by using the old data table functionality. However, to create new data tables, you must use the Data Explorer and Data Designer.
Thank you.
Bob Lloyd
PDN/Pega Academy Forums Support Team