- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-27-2022 10:45 PM
How can I multiply 'Unit Price' and 'Quantity' then display it on 'Price' Field and then display the sum in 'total cost'.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-28-2022 06:20 AM
Hi
You can follow the community reply by
Please find step by step solution below:
- Create a Widget and add the below-provided script:
api.controller = function($scope) { /* widget controller */ var c = this; $scope.$watch(function() { //Internal Name of Variable Set 'item_details' return $scope.page.g_form.getValue('item_details'); }, function(value) { if (value) { var mrvsData = JSON.parse(value.replace(/'/g, '')); console.log(value); var totalCost = 0; for (var i = 0; i < mrvsData.length; i++) { var mrvs = mrvsData[i]; totalCost += parseInt(mrvs.price); alert('Calculating: ' + totalCost + ' for --> ' + mrvs.price); } //Set Value in the Total Cost alert(totalCost); $scope.page.g_form.setValue('total_cost', totalCost); } }); };
- Create a Variable of type Custom and add the Widget created in Step 1
- Variable details are provided below:
- item_details: Internal Name of the MRVS Variable Set
- total_cost: Variable on the Catalog Item (not inside MRVS variable Set)
Please follow the above steps and import the Update set provided in the attachment.
Please mark my answer as correct if this solves your issues!
If it helped you in any way then please mark helpful!
Thanks and regards,
Kartik
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-01-2022 12:44 AM
great help.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-09-2023 12:32 PM
Hello,
Would this same process work if I am trying to somehow display items in the RITM that are deleted by selecting the "x" to remove. I want the user to be able to remove from the list, but we need the RITM to show what was removed before approving the request.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-20-2023 03:28 AM
Hello Sir, I have imported the update set in the PDI but total cost is not displaying after I added few items in multi row variable set.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-28-2025 04:07 AM
😍Its working ...Amaging
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-01-2023 12:01 PM
How are you able to do this if you have two or more MRVs to calculate the total cost?