Question
Sky Solutions LLC
US
Last activity: 4 May 2020 14:47 EDT
How do I calculate the percentage of two clipboard property values?
I am trying to divide the "passing" and "total" clipboard properties and multiply by 100 to come up with a percentage and display that in a section. Please provide steps in how to do this. Thank you!
***Edited by Moderator Marissa to update Platform Capability tags****
-
Like (0)
-
Share this page Facebook Twitter LinkedIn Email Copying... Copied!
Updated: 14 Jun 2021 7:38 EDT
Pegasystems Inc.
IN
You can use the divide function to achieve this. Please find the below screenshot for more details.
Sky Solutions LLC
US
Thank you for the reply Kanap, but I am trying to create a function that will have the values act as parameters because another case will not have the same numbers. Please guide me how to accomplish this.
Updated: 14 Jun 2021 7:38 EDT
Pegasystems Inc.
IN
The above one is for sample, Instead of numbers you can directly use properties inside the divide function like divide(.passing*100/.total) and set this value for the required property.
Sky Solutions LLC
US
I am unable to accomplish the task this way. Let me show you what I am trying to reference. I have posted pictures below showing what exactly I need to use. Thank you again for the help.
-
gianluca rossi
Pegasystems Inc.
IN
Hi,
Can you try setting the values of passing and total into parameters and try using divide(Param.Passing, Param.total)
Sky Solutions LLC
US
I would do this in a data transform right? Sorry I am beginner to Pega.
Pegasystems Inc.
IN
Yes,You can do it in Data transform or activity
Updated: 14 Jun 2021 7:38 EDT
Pegasystems Inc.
IN
I see that this is regarding the response you are receiving from Service. In the response Data Transform, after the properties are mapped, you can use declare expression to calculate the percentage using the divide function as mentioned above.
Sky Solutions LLC
US
Thank you Kanap. I have attempted to do so but an error is occurring.
Updated: 14 Jun 2021 7:38 EDT
Pegasystems Inc.
IN
Could you please check the clipboard structure of connectRest.response_POST.results_Summary.tests and define each page connectRest,response_POST.,esults_Summary.,tests in pages and classes with resepective class.
And one more thing, I think the above page is related to Response you received from REST integration and you can handle the mapping in the response Data Transform itself, instead of having a new Data Transform.
Blue Rose Technologies
DE
Hi,
From your original screenshot when you created the post, you have passing and total properties already populated with values. You can try calling the function as below,
divide(.passing*100,.total)
Updated: 14 Jun 2021 7:38 EDT
Pegasystems Inc.
IN
There is a typo-mistake in my above reply. It meant to be divide(.passing*100,.total)
Sky Solutions LLC
US
I was able to get it to work with the expression I have attached. Thank you for the help Kanap!