Question
BMO
US
Last activity: 13 Feb 2024 9:00 EST
How to create a database view that search two classes
Hello Community,
My apologies if this is a trivial question, I'm new and have searched around.
I'm trying to create a database view in pega platform Dev Studio so I can map my report definition to the view, but I'm not understanding the relationship between classes and tables. Can someone clarify?
I have two classes, AA-BB-C-DE and AA-BB-C-BB, that both save data to the same PegaData database named MyTable. There exists a record that is saved in either DE or BB class, but never both; I need to create a view that selects that record. So essentially the SQL query that I need is something like this:
select pyid from AA-BB-C-DE where pyid is not null
UNION
select pyid from AA-BB-C-BB where pyid is not null
Since both classes are connected to the same table (MyTable) my first thought was to create the view under AA-BB-C.
The problem is that when I check the Database Class Mappings under Configure > Data Model > Class & Properties > Database Class Mappings, I see that the class AA-BB-C is connected to a different PegaData database named pc_AA_BB_C that contains no records. Yet, classes DE and BB are connected to MyTable and contain many records.
What am I not understanding? Where is the property place to create this view?
@SergioR17001004
In Pega Platform, classes are mapped to database tables. Each class corresponds to a table in the database. When you create a database view, you're essentially creating a virtual table based on the result-set of an SQL statement. This view can include fields from one or more real tables in the database.
To map a class to a database view, you would use the Database Table form. This form allows you to revise existing class-to-table relationships. However, starting from Pega Platform 8.4.x, Pega stopped supporting database partitioning.
For creating reports, you can use the Visual Data Model to understand how the classes (which are mapped to tables or views in your database) relate to each other. This will help you in defining your report definitions.
Remember, any changes you make in the class or the database table will affect the other because of this mapping. So, if you create a new property in a class, a new column will be created in the corresponding database table, and vice versa.
⚠ This is a GenAI-powered tool. All generated answers require validation against the provided references.
Database tables
Viewing associations that are available for reporting
@SergioR17001004
In Pega Platform, classes are mapped to database tables. Each class corresponds to a table in the database. When you create a database view, you're essentially creating a virtual table based on the result-set of an SQL statement. This view can include fields from one or more real tables in the database.
To map a class to a database view, you would use the Database Table form. This form allows you to revise existing class-to-table relationships. However, starting from Pega Platform 8.4.x, Pega stopped supporting database partitioning.
For creating reports, you can use the Visual Data Model to understand how the classes (which are mapped to tables or views in your database) relate to each other. This will help you in defining your report definitions.
Remember, any changes you make in the class or the database table will affect the other because of this mapping. So, if you create a new property in a class, a new column will be created in the corresponding database table, and vice versa.
⚠ This is a GenAI-powered tool. All generated answers require validation against the provided references.
Database tables
Viewing associations that are available for reporting
Initial database schema
Also have a look at the explanation provided in CustomerData DB Instance/Schema