Posted: 18 Feb 2020 1:47 EST Last activity: 18 Feb 2020 15:56 EST
Getting cumulative total from Data Page in a table
I have seen how to create a Declare Expression to get the cumulative total from a collection property such as a Page List or a Data Page which returns a list. However, the problem I'm running into is that the examples I've found which include a data page don't have parameters.
My setup (Pega 7.3.1):
I have a table in a section that is backed by a datapage, we'll call D_GetCustomerSales[CustomerID: .CustomerID, StartDate: .StartDate, EndDate: .EndDate]
Obviously, since this is set in a table, the parameters are enumerated and I don't assign the params within the square braces as I've shown.
D_GetCustomerSales returns a list of MyProj-CustomerSales, which incudes a property called OrderTotalPrice.
Suppose the result of my table is as follows
Table [Data Page D_GetCustomerSales Results List of Class MyProj-CustomerSales]
How would I setup my Declare Expression so that I can get the sum of OrderTotalPrice? I've got my property CumulativeOrderTotalPrice in the MyProj-CustomerSales class. And that is where the Declare Expression is located that I'm trying to create. But I think that if I do
Sum Of [ D_GetCustomerSales().OrderTotalPrice ] it would return all the values for OrderTotalPrice, not just the ones limited by the properties filtered in the table.
Ooh, that probably would work. Unfortunately, the properties the provide the filter live in a different class and some are optional.
After discussing with one of my more experienced Pega devs on the team, we determined that it would be easier to generate a running total in the mapping data transform as we retrieve the data from the database.