Posted: 8 Aug 2019 7:22 EDT Last activity: 8 Aug 2019 23:43 EDT
Property value overriding
I'm preparing an online products store application in Pega. In the ProductsShelf screen, user will be selecting the products from the available list. In a dynamic layout I've the products dropdown and quantity dropdown (1 - 10). In this quantity dropdown property. I've specified the table type by local list with values from 1 to 10. In the next screen ShowCart, we will be displaying what all items user has selected along with the quantity and calculate the line total.
I've two problems here:
Firstly, whatever value the user is selecting from the quantity dropdown, it is taking the first choice by default for all the items (like if I choose product A qty 2, product B qty4, in the next screen it's displaying product A qty 2, product B qty 2).
Secondly, I've a declare expression to calculate the line total. I'm setting the Line total as the product of quantity and a constant value (999), but since the quantity is getting constant, so is the line total.
I'm not getting where I'm getting wrong. Is there is any solution to this ? Please suggest someone.I thought of making quantity as a page list property but can't get sure.
I've attached ss of screen 2 and 3 for your reference.
It would be helpful to see your underlying configuration. If I had to hazard a guess, you are using the same page/property for each row, so one value is being applied everywhere. Is each row part of something like a page list? If not, that would help isolate the data. Something like...
orders(1).product and orders(1).quantity for the first row, and
orders(2).product / orders(2).quantity for the second row, and so on.
Then each page could have a calculated value which is derived by looking at a product table and multiplying the price by orders(n).quantity.
You could make quantity a pagelist and walk through it, but honestly isolating each row onto its own page allows you to write simple logic for each page without having to worry about if the row is ProductA or ProductB. It also makes life much easier if someone wants to do something like remove the second row of 3 because they decide they don't want to buy that product.