There are 2 tables one has 1000 records and one has 0 records now we need to copy records number 51 to 71 from table 1 to table 2 with 0 records,now i am planning to do a obj browse but i am not sure how to give the index of records from table1,also if there is any alternate way,let me know.
If your requirement is to copy or modify table data/columns at the database level, you can raise a CC request with the appropriate SQL query for the DBA team to execute.
What do you mean by “table”? Is it a work table containing work objects, or a table storing data class instances?
Depending on the type of records, the approach would differ.
If these are data instances:
For a one-time migration, you could export the records to a CSV file.
Copy only the required records (51-71) into another UTF-8 encoded CSV matching the structure of the target data type.
Import the CSV into the target data type using the Data Designer import functionality.
If these are work objects:
First, define the sort order that determines what constitutes records 51-71. Database tables do not inherently have a fixed “51st” or “71st” record unless a specific ordering is applied.
Create a Report Definition with the required sorting and filtering criteria.
Retrieve the required work objects and iterate through the desired records in an activity.
Use the pzInsKey to open each source work object and create a corresponding work object in the target class (assuming the source and target classes have compatible structures).
Also, if this is a Pega implementation requirement rather than a one-time data migration, I would prefer a Report Definition-based approach over relying on Obj-Browse indexes, since Obj-Browse does not directly support retrieving records by position (for example, records 51-71) without defining pagination and ordering.
Could you share a bit more about the use case and clarify whether these are work objects or data instances? That would help in suggesting the most appropriate approach.
A better approach is to use a Report Definition with appropriate filtering and sorting criteria to retrieve only the records that need to be migrated. Then iterate through the results and persist them into the target table. I hope index can be passed a parameter to filter the results.
If the source and target are Data Objects, you can leverage a Savable Data Page to encapsulate the save logic and keep the implementation reusable and maintainable. Report Definitions and Savable Data Pages as the preferred mechanisms for accessing and persisting data
In Pega Report Definitions, you can limit the number of retrieved records using the Maximum number of rows to retrieve setting on the Data Access tab, or dynamically via the internal property pyMaxRecords@TanyaS58
If these are work instances, why are you copying the data from one work table to another Worktable? What would happen to associated index tables,SLAs, Assignments, etc?? Are you supposed to copy that as well?
I’m not about the intent about copying the Work objects from one table to another because the data could change overtime as when the case move forward with the workflow. Do you know the business justifications to copy the Worktable to another table?
Technically, it’s possible to migrate the records from your work table to another table. However, we need to understand about the intent to provide the correct recommendations. Work Objects has other depdendency tables like SLAs, Index, attachments, etc…