Saving embedded data from a declare index or savable data page?

Hi,

If we want to save an embedded page, we can:

  1. Use a declare index to write data to an index table
  2. Leverage a savable data page to write data to a SOR
  3. Write an activity to do an Obj-Save

I can see why a savable data page trumps using an activity with an Obj-Save in most cases. However, I’m more curious about when we can use a declare index to save embedded data, because there are some common denominators between them:

  • Both options use a seperate table to store data / both options store data outside of the BLOB of the case
  • Both options are declarative (whenever a property or datapage reference is used, data is saved)

And some differences:

  • Index table uses Index-, savable data pages use Data-
  • Referencing data from an index table in UI is a lot less straightforward than referencing the same savable data page that can also be used to perform a lookup
  • Data pages provide caching, a refresh strategy and conditional sources, index tables can only conditionally index case data

So in most cases we can choose savable data page as a more flexible and implementation hiding option, but are there also cases where we would absolutely benefit from using declare indexes?

Hi @BasG0629: Here is my view.

If you want to save the data which is within the case, I still prefer to use Declarative rules rather than using savable Data pages. When you use a savable data page, you may need to explicitly save them in certain scenarios like when agents doing a update on the case. But declarative rules will take care of it.

Other main benefit of declare index is to optimize the list data within the case.

For Savable data pages; the main purpose of this is to fetch, update, save the data back to the SOR. It will be good if you use them when your design pattern is to get the data from the external system (not storing it with in the case layer), you want to save the updates back to the SOR.

Please let us know if this helps.

Thanks.

@BasG0629

Declarative Index is a declarative rule; you don’t need to write any additional code to “sync” the data between BLOB of work table and declare index DB table. Insert, update and most importantly delete operation is handled automatically by PRPC.

@ArulDevan Agreed! Savable datapages encapsulate a lookup and a save - just the save is usually enough, and we don’t have to account for case updates by system operators and such. And I agree it’s quicker to retrieve data from declare indexes rather than ‘regular’ database tables.

Thanks for the insight!

@Nirmalya.SenSharma I hadn’t thought of the deletion of records either. If we want to do this with a savable datpage, we have to explicitly do a Page-Remove or DELETE HTTP to achieve this. Both answers definitely help me in making the right choice! Thanks :slight_smile: