doing calculations using data from a collection

I need to calculate a number based on a multiplication of 2 fields in one dataset.

Currently, the page is only a a dynamic page that shows data from a collection entry.
There are 2 text objects:
One that shows price of na expense (#Valor) in its original currency
Another that shows input of a currency exchange (#PTAX)
My collection fields for both are of type Text, because it waqs the only way to make them save numbers with . (for thousands) and , (for decimals) separators. Not sure if they should be type number, but it difficulted me to make the system to automatically input . and , for the user while (s)he types.
In summary, I want the dynamic page to show to my user the multiplication of the text object named #Valor (obtained by the connection of the text object to the collection) and the other text object, named #PTAX, and show the result in another text object called #Resultado.
My current code for this, after several tentatives, is showing only the initial text of the text object, in a certain moment, with different code, i could obtain NaN and 0, but I could not manage to understand how the calculation woks:
Here is my code:

$w.onReady (funcion () {
	var valor = parseFloat($w(“#Valor”).text;
	var PTAX = parseFloat($w(“PTAX”).text;
	var resultado = valor * PTAX;
return resultado
}
$w(“#Resultado”).text = resultado

I also tried:

$w(“#Resultado”).text =  String(parseFloat($w(“#Valor”).text * parseFloat($w(“#PTAX”).text)

With this one, I’ve got 0

I also tried after get hook placed at backend data.js
With that code:

Export function Financeiro_afterGet (item, context) {
Item.valorcalculado = Number (item.valor) * Number(item.taxaConversao)
return item

Idon’t know how to make this information be placed on my dynamic page.


In another question, I have a table (#table1) that shows several expenses at the same time. With use of filters, user can select type of expense and other options and I want to show to user the sum of all items shown at the table, and refresh result as the user filter the data.
My collection name is Financeiro
My collection fields are: Valor and TaxaConversao, both are set as text.

this challenge I could not even start.

Can somebody help me on these two scripts?