Shay Shmeltzer's Oracle Development Tools Tips

Adding Calculated Fields to Your Visual Builder UI

Shay Shmeltzer
Director of Product Management - Oracle

This is a quick blog to show two techniques for adding calculated fields to an Oracle Visual Builder application.

Both techniques do the calculation on the client side (in the browser). Keep in mind that you might want to consider doing the calculation on the back-end of your application and get the calculated value delivered directly to your client - in some cases this results in better performance. But sometimes you don't have access to modify the backend, or you can't do calculations there, so here we go:

1. For simple calculation you can just use the value property of a field to do the calculation for you.

For example if you need to know the yearly salary you can take the value in a field and just add *12 to it.

You can also use this to calculate values from multiple fields for example [[$current.data.firstName + " " +$current.data.lastName]] - will get you a field with the full name.

2. For more complex calculation you might need to write some logic to arrive at your calculated value, for example if you have multiple if/then conditions. To do that you can create a client side JavaScript function in your page's JS section. Then you refer to the function from your UI component's value attribute using something like {{$functions.myFunc($current.data.salary)}}

As you'll see in the demo, if you switch to the code view of your application the code editor in Oracle VB will give you code insight into the functions you have for your page, helping you eliminate coding errors.

Join the discussion

Comments ( 3 )
  • Ajit Kumar Saturday, December 8, 2018
    Thanks Shay. It was good information. Hope VBCS gets similar and easy feature to calculate all values in one column and display in an input text at the bottom of that column. At the moment, there is a need for far more coding to achieve the same.
  • Raluca Tuesday, May 26, 2020

    If we want to calculate a total sum on a specific column based only on certain selected rows on the table, how can we proceed? the total sum we can put into new field text.
  • shay Wednesday, May 27, 2020
    A better place to ask questions is on our forum - https://cloudcustomerconnect.oracle.com/resources/e610f4723c/summary
    The calculation should be done on the backend - expose a REST service that returns the sum you need.
    If you are using BOs you can create a BO object function that will return this.
Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.