Press "Enter" to skip to content

How to configure Declare index in Pega – step by step tutorial



In this post, we will learn how to configure declare index in Pega. Its highly recommend to visit my previous post on declare index rule

Here let us see the tutorial how to implement  the declare Index in Pega.

What are the pre-requisites to configure declare index in Pega?

  • Imagine the below scenario, address details are captured in a page property ‘Address’
  • we need the expose Street, City & state in separate table for reporting purpose.

You can see the property structure below


1. Create new properties ( 7 properties) 

Single value properties – Customer name, Phone number and Age created in work class

Page property – Address created in work class

  • Street, City & State created in Address page definition ‘MyKnowPega-Data-Address’.

Here  we added the properties under Address page property.

2. Create a simple starter  flow

3. In the flow action create a simple screen to hold the all six values.

Note: For address, Refer the fields as .Address.Street, .Address.City & .Address.State 🙂

Now let’s run the flow and enter valid details.

Submit it.

Check the same in database worktable for C-1

  • You can see the details get persisted in DB.

Age, Customer Name, Phone Number are populated in exposed columns.

  • The address details are compressed in BLOB.

Note: I already exposed those 3 columns explicitly in worktable

Good 🙂


  • User wants to report on the customer details including the address values.
  • Since the address values are stored in BLOB, it affects reporting performance.

So we decided to create Index for address properties and expose it as separate columns in Index table.

How do we start configuring Declare Index?

Step 1: Create an Index table.

Table name – Index_Address

Note: I am using Postgres SQL. I got the admin rights to create table. If there is privilege restriction, kindly consult with DBA team to create a new Index table along with columns.

Don’t forget to include the main key columns and pzInskey 🙂

  • I have successfully created a new table. You can verify it below

New table with 10 columns.

Step 2: create a new index class in Pega

  • Provide the required properties as keys. You can visit my previous post to get the complete information about Keys.

Step 3: Create a new datatable instance

Note: Remember you can also use database class mapping wizard for mapping.

For more info, please visit my post on database class mapping wizard.

Here I am going to do manually.

  • Set the database name as ‘PegaDATA’ & table name as Index_Address

Step 4: Create the three properties in Index-address class.

  • single value properties – Street, City, State.

Step 5: create a new declare Index rule


Source page context – .Address

Source page context – MyKnowPega-Data-Address

Index class to write – Index-Address

Properties for Indexing and mapping –

Set the source property from address page in left hand side and Index property on right hand side.

How simple is this. We have successfully configured declare index in Pega.

Let’s test it.

Step 1: Run the starter flow.

Step 2: Provide some valid values in the customer details screen.

Submit the screen.

Step 3: open the DB and verify the record in work table. ( C-7)

  • Customer Name, Age, phone number values are set correctly.

Now let’s check out index table.

Step 4: Open the Index-Address table and check the address values.

Guess what !! 🙂


Now let us test it differently 🙂

Step 1: Create test activity.

Step 2: In the first step  – Open the C-7 work item

Step 3: In the second step – Property-set on address values

Step 4: In the last step – Obj-save with commit.

So what we are doing here? We are manually updating the address values. When we save the work item, Index table should be updated with new address values right? Let’s check it 🙂

Step 5: Run the activity from other actions button.

Step 6: Check the record in the index table. Pakka 😀

Step 7: Let’s do one thing,

  • Update the test activity to delete the workitem, but don’t commit now.
  • Leave immediate unchecked

This is just a one step activity.

If you see both the work table & index table record still persists and not deleted.

The reason is declare index fired only when the DB action is committed in database

Step 8: Check immediate & run the same activity.

Step 9: Check in the Index-Address table

It’s gone…… disappeared. 🙂

what are the things to remember when configuring a new Declare Index in Pega?

  1. Create a new Index table.

If you don’t have the privilege to create a new table, seek DBA team advice and get it done.

  1. Create a new Index class – Include 3 key properties

pXInsIndexedInskey, pxIndexcount & pxIndexPurpose are the three key properties

  1. Create new properties that we need to expose in Index table

Create those properties under Index class.

  1. Create a new database table instance and map the Class with the Index table created in DB.
  2. Finally create declare Index rule and configure all the details

If you need to know the other declarative rules, check out the below category 🙂

See ya in next post 🙂

    • Premkumar G Premkumar G

      Thank you so much, Suresh. 🙂

  1. Ramanareddy Ramanareddy

    HI prem,

    Good post on declare index.My all quires are cleared..Keep it up

    • Premkumar G Premkumar G

      Thank you so much for your appreciation, Ramanareddy. 🙂
      Glad that you find it useful. 🙂

  2. Raghav Raghav

    Excellent post Prem.

    • Premkumar G Premkumar G

      Thank you so much, Raghav. 🙂

  3. Bramha Bramha

    Good Explanation Bro…

    • Premkumar G Premkumar G

      Thank you so much, Bramha 🙂

  4. Vinod Vinod

    Awesome Dude..

    • Premkumar G Premkumar G

      Thank you so much, Vinod. 😀

  5. Sahithi Sahithi

    The whole concept of Declare Index is explained very clearly and easily understandable. Thanks !!

    • Premkumar G Premkumar G

      Thank you so much for your appreciation, Sahithi. 🙂
      Glad that you like it. 🙂

  6. MastanReddy Avula MastanReddy Avula

    hi praveen
    can you explain what is the diff b/w stacked and default in dynamic layout

    • Premkumar G Premkumar G

      Hi Mastan,
      You can find the answer on your own :). Open you application skin -> Component styles -> Dynamic layouts -> Formats ( Inherited)
      Check both stacked and default. You will see some difference in width and height.

      Note: Columns per row is 1 in both the formats. Its like Default behaves like a stacked format.
      Hope you are clear now :)……. By the way, I am Prem, not Praveen 😉

  7. Eshwar Eshwar

    Many Thanks for Explanation Prem 🙂

    • Premkumar G Premkumar G

      You are most welcome, Eshwar. 🙂

  8. Rupesh Rupesh

    Hi Prem,

    How did you expose the 3 properties explictly in work table?

    Rupesh M

    • Premkumar G Premkumar G

      exposing properties – You can either get the help from DBA team to create new columns in DB table ( if you dont have access) else you can manually create new columns. You need to save the data table instance once. Now the mapping is done.

      There is another simple option, in the property rule Other action button -> Optimize. On completing the wizard, a new column will be created in the corresponsing DB table.

  9. Manoj Manoj

    Good post
    Really appreciated

    Keep it up bro….

    • Premkumar G Premkumar G

      Thank you so much for your appreciation, Manoj. 🙂

  10. swapna swapna

    No posts!!!!!!!!!!!!!! Its a long gap.

    • Premkumar G Premkumar G

      Oh, I’m so sorry for the delay, Swapna. I’ll try to post something new within this week. I’m a little busy, but I’ll definitely post a new post soon. Stay tuned.

  11. Shiv Shiv

    Excellent Work. Looking forward to gain more knowledge from your posts.

    • Premkumar G Premkumar G

      Thank you so much, Shiv. 🙂
      Stay tuned for more posts. 🙂

  12. Sidharth Sidharth

    Good presentation and very useful

    • Premkumar G Premkumar G

      Thank you so much for your appreciation, Sidharth. 🙂

  13. Pavani Pavani

    A quick question Table should have keys which are in class rule right i imean pxindexedKey,pxindexcount,indexpurpose. Else table class connecivity will fail na. But i see in your post its different.

  14. Abdul Qader Mohammed Abdul Qader Mohammed

    Thank You PREM..!!! Probably this is the best place to learn PEGA.

    • Premkumar G Premkumar G

      You are most welcome, Abdul. 🙂
      I’m feeling elated on reading your comment. 🙂
      Thank you so much for your appreciation. 🙂

    • Srinivas Thumati Srinivas Thumati

      Exactly Abdul…

  15. pratik pratik

    all think are good .but why you always written one name”Aarti”…<>

    • Premkumar G Premkumar G

      Ha Ha <3

  16. Srinivas Thumati Srinivas Thumati

    Explained Declare Index in a simple way. Thank you Prem. You just nailed it man.. kudos !!

    • Premkumar G Premkumar G

      Thank you so much for your appreciation, Srinivas Thumati. 😀
      You are most welcome. 🙂

  17. ashok ashok

    A new property add to pagelist,that page list already exposed by declare index rule ,will the new added property saved into index table

  18. Suresh Suresh

    When I exposed property manually which class property’s we expose like index class or data class or work class page property what is the difference when I exposed all the place what happened? Can u please explain me.

  19. Raj Raj

    I have a declare index(INDEX_CBB) in HWay-GCAA-CBB-Work-ABBPolicy level. So i need to move this index to generic level that is HWay-GCAA-CBB-Work. So is it possible to do this doing just a move this rule to generic level. Is there any think do i have to do?


  20. Chandrasekhar Reddy Allampati Chandrasekhar Reddy Allampati

    Hi Prem,
    I have requirement that I have to write one time activity to browse ***** work objects and update with some data and commit , it’s working fine as expected n updating work objects, but it’s not updating in index table , seems to trigger declared index something is missing when we updating through activity.

    Note: when I open and update work object it’s triggered and updated index table.


    Chandrasekhar Reddy Allampati

  21. PegaLearner PegaLearner

    Can u please explain about contraints rule in detail ?

  22. Sunayana Sunayana

    Hi Prem,
    Nice Explanation.

    I have one query here, create a declare Index class and created properties in that class. How the exposing of the properties is happening(without taking help from DB team). we have to do Property Optimization from pega end(if it is PEGA DB)?
    In pega7 The data class properties are already exposed in the pega db. we can create report by using this properties right? what is the point going for Declare Index ?

  23. Shabbeer Shabbeer

    Hi, I have doubt, is there any mandatory to have property names are same in both source context class and index class to map. suppose I have property pxEnterStageTime, I cant create that in index class bcz px, py, pz are reserved properties, instead I have created one property of same data type, Is this works or, any other solution… please reply me

  24. Kumar Kumar

    i think this is the best place to deep dive in Pega.
    keep up the good work PREM !!!!

  25. Ravi Kumar Voturi Ravi Kumar Voturi

    Gem of an explanation..!
    Loved it..!!

  26. seshagiri seshagiri

    i have a scenario,

    in previous sprints i have a page list property on clipboard and there was no declare index created by that time,and that piece of code is now production.

    Now in this sprint i have created a declare index on pagelist property and moved it to production.

    so how do i index the previous production cases ,that were created before the declare index in production?

    • Krishna Krishna

      Is this issue resolved? I am also facing the same

  27. raji raji

    Hi Prem
    I am using personal edition.can you explain how to use declare index in pega database.

    • Premkumar G Premkumar G

      Hi Raji, i used personal edition as well in the tutorial. pega personal edition comes with postgres database.
      It will be within your downloaded package. Run the .exe file. Add a new connector providing username -postgres ; password – postgres;
      You can access the database

  28. Dillo Daniel Dillo Daniel

    Great place to learn the concepts … Good Job.. Kudos!!

  29. Tanu Tanu

    Easy to understand! Very well documented… Appreciate your efforts..
    Small question: where do we use abstract class and where do we use concrete class?

  30. syamu syamu

    Good post….Prem

    • Premkumar G Premkumar G

      Thank you, Syamu. 🙂

  31. sreekanth sreekanth

    very helpful, nice way of explanation.

    • Premkumar G Premkumar G

      Thank you so much, Sreekanth. 🙂

  32. Nitesh Agarwal Nitesh Agarwal

    Hi Prem,

    Recently only i have started reading all the post provided by you. Your way of explanation is superb. It clears all the doubts.

    • Premkumar G Premkumar G

      Hello Nitesh,

      I’m glad to hear that you like my blog. Thank you so much for your appreciation. 🙂

  33. Mohammed Warish Mohammed Warish

    thanks for helping us with ur posts bro..can you do a topic on decision rules and how to configure them?It would be very very helpful for all of ur followers.

    • Premkumar G Premkumar G

      You are most welcome, Mohammed Warish. 😀
      Okay bro, I’ve taken note of that topic. I’ll post about it soon. Stay tuned !

  34. Rajesh Kumar Rajesh Kumar

    Hi Prem,

    One question, Do we required to have pzpvStream cloumn for the index table? Even though all column are expose?

    If not required.
    Then, if i want to run an extract rule my understanding is extract always fetch data from pzpvstream.

  35. Aydin Aydin

    Hi Prekumar,

    We already have a declare index which is working fine.
    Now we would like add a new column to that table. We added the properties on the data and index classes. We also created the column to DB table. Finally we have updated the declare index rule to populate this field.

    We are missing something but what ?
    We get the following error.

    yCommitError:** Cannot save instance of class Index-ABCCorp-FW-ImportLCFW-Data-DocumentPaymentInfo; it belongs to fully exposed table PRPCDATA.PR_INDEX_ABCCorp_DocPaymentInfo in database PegaDATA, but the instance has properties which do not correspond to columns: BusinessDayDiff

    What do you think ?

  36. Bharathi Bharathi

    How pxInsIndexedKey,pxIndexedCount,pxIndexpurpose is storing in the index table.what is the OOTB code for these values saving in Declare index table.

  37. veera veera

    Hi Prem,

    I have Created an indexed table in postgres (Index_TableName) manually and created Index-Class when i save this class it connect to Pega database table (pr_Index_classname)
    but i want to make this class to connect with (Index_TableName) which i have created in Postgres database.

    i was tried to map the class with table using (external database table class mapping) there i have given DB name , Tablename (Index_TableName) , & Class Name (Index-Class) but it is not working.

  38. Sam Sam

    Excellent Post!!
    Just a quick question to which table is the MyknowledgePega-Data-Address class mapped too?

  39. Mani Mani


    Can You Explain Us how we can display the data in reports when we have to browse data from 2 page or page list properties ?


Leave a Reply

Your email address will not be published. Required fields are marked *

error: Content is protected !!