Show calculated attribute in input field

I have an expense capturing screen, with rows. My aggregate calculates VAT as (Amount*15/115). 

I need to pass the calculated attribute so that when the user enters the amount, say 500 and the VAT input-field shows the calculated amount (65) as shown

I need to do it this way so that the user is able to change the amount before saving, since some expenses might be out by 1 or 2 cents for example.

The .oml is also attached. Please assist!

EditableTable.oml

Solution

I did this, but you will need to think of a way to deal better with your data.

Instead of having aggregates and local variables in the same data you will have problems because at this moment you don't have any ids and you cannot look for records without ids just using the current row number. But to use the current row number you will need to have everything in the same structure.

If you want to use local variables and aggregates in the same table you will need to create the record in the database and return the id and append it to the aggregate/list the id created, this way you can use the list index of to find the record with he id you are trying to update.

Right now I am passing the amount and the currentrownumber

And I use an action to do the calculations and to update the record in the same list.

The current row number comes from the local list on the table. With the current row number, I can go directly to the record and update it.

You can use this or you can find the position of the record using the list index of when you got everything working using the aggregates. But for now, you should check the sol and try to see what is best for you.

Because right now I am using the vat from the local list

Check the OML.

Regards,

Márcio

EditableTable.oml

Good day,

Thank you for the solution and the advice. I am new to Outsystems and still learning the Reactive Course. I needed an Invoice capturing type format and that is all I could come up with. 

Do you perhaps have a better model for capturing invoice as shown below, for example?

I don't know and I had a look on the Forge and I couldn't find a better model. But have a look at this OML you can find a sample_invoice screen but it's not editable, it's the demo from the UltimatePDF component on Forge. But you are on the right track, you just need to align what I said before.


UltimatePDF_Demo_SampleInvoice.oml

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.