667
Views
4
Comments
Solved
how the best way to calculate the percentage of a number in OutSystems?
Question

Hello, 

What way do you suggest to calculate the percentage of a number in OutSystems?

My situation is as follows, I have an exam (ExameStudent entity):

1. and I have data on it that tells how many questions are on the form (NumberMaximumOfQuestion);

2.  how many questions the student got right (NumberOfCorrectQuestions) 

3. and what is the minimum percentage to be considered approved (MinimuScore).

 (all of this information is already in my database) But I can't list it so that I know if the student has reached the minimum percentage of questions to pass.

I'm having trouble building that logic.

I made some attempts to unite these attributes within an aggregate, but I still haven't been successful. and I don't know if I'm on the right track...

can anybody help me?


Best Regards. 

Jessica Marques. 


2025-11-19 06-14-01
Miguel Verdasca
Champion
Solution

Hi,

Each student will have an entry on that table right? You will get this student data from that table, filtering by the student ID, and you can assign it to a local variable, for example.


Then, you just have to do an assign to another local variable:

(# Correct Questions / # Total Questions) * 100


And you have the percentage of questions correct. And then you just have to make sure that this value is equal to or higher than the minimum value that you have saved in your database.


Note, multiply by 100 if the value you have saved in your database for a minimum value, is between 0 and 100 ... if it is between 0 and 1, do not multiply by 100.

Cheers

2020-09-15 09-38-17
Jessica Marques

Miguel Verdasca wrote:

Hi,

Each student will have an entry on that table right? You will get this student data from that table, filtering by the student ID, and you can assign it to a local variable, for example.


Then, you just have to do an assign to another local variable:

(# Right Questions / # Total Questions) * 100


And you have the percentage of questions correct. And then you just have to make sure that this value is equal to or higher than the minimum value that you have saved in your database.


Note, multiply by 100 if the value you have saved in your database for a minimum value, is between 0 and 100 ... if it is between 0 and 1, do not multiply by 100.

Cheers

 

 ok. I will tr...



2025-11-19 06-14-01
Miguel Verdasca
Champion

It's simple Jessica. If you need more help let me know! =)

2020-09-15 09-38-17
Jessica Marques

Miguel Verdasca wrote:

It's simple Jessica. If you need more help let me know! =)

 

 Hi, Miguel Verdasca, 

It stayed that way and worked very well.

Thank you!

Regards,

Jessica

( ExamStudentLocal.NumberOfCorrectQuestions / ExamStudentLocal.NumberMaximumOfQuestion) * 100
Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.