Dynamic class referencing in RDB-List
We have to connect to different database servers based on sites to fetch data into pega and we have created class rules and DADT instances to accomplish the same
Example below
Class: mhn-fw-icfw-data-site1table1
DataAdminDBTable :: mhn-fw-icfw-data-site1table1-- This points to the actual schema and tablename(site1)
class::mhn-fw-icfw-data-site2table1
DataAdminDBTable :: mhn-fw-icfw-data-site2table1 -- This points to the actual schema and tablename(site2)
We want to construct the classname and use the same within the connect sql rule to connect to the right database at runtime
I am using the below syntax, however, pega is doing only one level of substitution.. SQLPage.ClassName is set in the activity based on the site ( for example, it can have a value mhn-fw-icfw-data-site2table1)
select columname from {SQLPage.ClassName} where ID='123423'
At runtime, pega is doing a substitution like this(SQLStatementpost) looks like the below
Select columnname from {Class:mhn-fw-icfw-data-site2table1} where ID='123423' and it fails because the {class:} is not actually substituted with the values from the DADT instance.
Where as if I directly use the sqlstatementpost syntax in the sql rule directly (above), it works good as the substitution is proper.. Our goal is to use a clipboard property there for reusability so that we don't have to duplicate this sql rule for each database instance..
Can we force pega to do this double deferencing??
We have to connect to different database servers based on sites to fetch data into pega and we have created class rules and DADT instances to accomplish the same
Example below
Class: mhn-fw-icfw-data-site1table1
DataAdminDBTable :: mhn-fw-icfw-data-site1table1-- This points to the actual schema and tablename(site1)
class::mhn-fw-icfw-data-site2table1
DataAdminDBTable :: mhn-fw-icfw-data-site2table1 -- This points to the actual schema and tablename(site2)
We want to construct the classname and use the same within the connect sql rule to connect to the right database at runtime
I am using the below syntax, however, pega is doing only one level of substitution.. SQLPage.ClassName is set in the activity based on the site ( for example, it can have a value mhn-fw-icfw-data-site2table1)
select columname from {SQLPage.ClassName} where ID='123423'
At runtime, pega is doing a substitution like this(SQLStatementpost) looks like the below
Select columnname from {Class:mhn-fw-icfw-data-site2table1} where ID='123423' and it fails because the {class:} is not actually substituted with the values from the DADT instance.
Where as if I directly use the sqlstatementpost syntax in the sql rule directly (above), it works good as the substitution is proper.. Our goal is to use a clipboard property there for reusability so that we don't have to duplicate this sql rule for each database instance..
Can we force pega to do this double deferencing??
i)Deference the property value first
ii)Then deference the schema/table from the DADT instance based on the clipboard property value.
Message was edited by: Lochan to add Category