Simple Operation

Simple Operation

I want to know how i can a make mathmatic opaeration on OutSystem, just divide one value by other where the user will type the two values and an Expression will show the result, I tried to create all the local variables and assign but i can't finish this.

The Only thing that appears when i type the values and press the "Calc" button is that the expression turns in 0 and the text fields turns to 1
Hi Eduardo, 

What you want to do is realy simple in OS. You just need 3 screen variables (one for each value and one for result) and build a screen with 2 inputs fields, one expression and one button.
The action associated with button just need to do the operation in one assign, and set the result into the result variable, use the Ajax refresh widget to refresh the result on expression and its done.

You can get more information and some useful examples in Academy Homepage.

Thanks Ricardo, but I'm using all the methods that you said.
With the breakpoint I can see that the Two Variables receives the value but the final/total variable doesn't receive any value of the operation
Why these is happening?
Hello Eduardo, 
Are you using the result variable in your screen? That behaviour Its a litle bit weird.
If you can upload your eSpace could be more easy to understand the problem.
Here is the eSpace
Hi Eduardo,
Looking at your eSpace I see that you are confused on how to use expressions, how the user input can be used on the server side, and several other basic concepts.
My advice for you is to watch the videos at the Academy, and practice with them. This way you'll master the most fundamental concepts of the OutSystems Platform.

For understanding how to manipulate user inputs you can see the videos from 5. Data Binding in Form Inputs.

Now, I don't want to leave you empty handed, so I'll try to explain you problem.

Your expression is returning a Boolean. I understand why this makes sense to you, but this is basically what to are doing:
total == Decimal.Parse("3.1415")/ Decimal.Parse("2.0")

As you can understand, this is not efficient, change friendly...
So if you just change your expression to inputqtd/inputperc, this would return what you are expecting.

In your 'Calcular' action, the only thing you need to do, is use the refresh action, to refresh the expressions. You don't need the assign (it is simply wrong), and you can optmize to refresh only the expression, and not the whole container.

Again, you should definitly check out the Academy videos :)