- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-24-2024 09:48 PM
Create a button (Total amount) whenever we click that button that button should calculate(quantity*price)
please suggest me possible ways how to achieve this.
Solved! Go to Solution.
- Labels:
-
Cre

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-25-2024 12:10 AM - edited 04-25-2024 12:11 AM
Hi @siva118 ,
I tried your problem in my PDI and it works for me, Please check the script below
function showTotal(){
alert("here");
var quan = g_form.getValue('u_quantity');
var price = g_form.getValue('u_price');
var total = g_form.getValue('u_total');
alert("quan = " + quan + " price = " + price + " total = " + total );
g_form.setValue('u_total', quan*price);
}
Note: I create 3 fields on incident table - Quantity - Integer type, Price- Integer type, Total - Integer type
Result
When I click total button it shows the result
Please mark my answer correct and helpful if this works for you
Thanks and Regards
Sarthak

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-25-2024 03:21 AM
Hi @siva118 ,
I had done as you say like quantity field type is (Integer), Price field type is (currency), Total Amount field is (currency)
function showTotal() {
var quan = g_form.getValue('u_quantity');
var price = g_form.getValue('u_price_222');
var total = g_form.getValue('u_total_222');
alert("quan = " + quan + " price = " + price + " total = " + total);
var intPrice = price.split(';');
alert('intPrice = ' + intPrice[1]);
var intTotal = total.split(';');
var totalValue = intTotal[0] + ";" + quan * intPrice[1];
alert('Total = ' + intTotal);
g_form.setValue('u_total_222', totalValue);
}
Here is result
Please mark my answer correct and helpful if this works for you
Thanks and Regards
Sarthak
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-25-2024 02:36 AM
Thank you
This script only working on string type of fields but I want in currency type of fields please suggest how to achieve best way

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-25-2024 02:39 AM
Hi @siva118 ,
It also works for currency field please use below code
function showTotal(){
var quan = g_form.getValue('u_quantity');
var price = g_form.getValue('u_price_222');
var total = g_form.getValue('u_total');
alert("quan = " + quan + " price = " + price + " total = " + total );
var intPrice = price.split(';');
alert('intPrice = ' + intPrice[1]);
g_form.setValue('u_total', quan*intPrice[1]);
}
Result
I created new field of type currency named Price222
Now I click on UI action Total
Please mark my answer correct and helpful if this works for you
Thanks and Regards
Sarthak
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-25-2024 03:06 AM
Thank you for responding
quantity field type is (Integer)
Price field type is (currency)
Total Amount field is (currency)
Could you please do these changes and give me the result
Thanks and Regards
Siva B

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-25-2024 03:21 AM
Hi @siva118 ,
I had done as you say like quantity field type is (Integer), Price field type is (currency), Total Amount field is (currency)
function showTotal() {
var quan = g_form.getValue('u_quantity');
var price = g_form.getValue('u_price_222');
var total = g_form.getValue('u_total_222');
alert("quan = " + quan + " price = " + price + " total = " + total);
var intPrice = price.split(';');
alert('intPrice = ' + intPrice[1]);
var intTotal = total.split(';');
var totalValue = intTotal[0] + ";" + quan * intPrice[1];
alert('Total = ' + intTotal);
g_form.setValue('u_total_222', totalValue);
}
Here is result
Please mark my answer correct and helpful if this works for you
Thanks and Regards
Sarthak
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-25-2024 04:33 AM
Thank you bro
It's working good
Thanks and Regards
Siva B