advanced calculation question

By: Dev S | Asked: 02/06/2023
ForumsCategory: How-toadvanced calculation question
Dev S asked 1 year ago
I have two rows with numbers (the example in the screenshot is , the quantity of numbers varies from 1 to 6). I need to dynamically find the difference between the quantity of these numbers (assuming that the first row always has more numbers than the second) And after that, find the sum of the numbers that are filled in the first row, but not filled in the second (that is, in the example shown in the screenshot, there are no numbers in the last two cells in the second row, but there are in the first row. That is, I need to find the sum of the last two cells of the first row. The answer will be 90). How can I implement this? Thanks in advance :) :) 
Attachments
2 Answers
Victor Font answered 1 year ago
You need to do this in jQuery. You don't mention the type of field you're using to capture the rows of numbers. It makes a difference in the jQuery code. Please explain with more form construction details.
Dev S answered 1 year ago
Thanks for your reply, Victor. Here's more specifics.   1) So - I have two fields. Let's say the field X and Y for which the values I need to enter are between 1 to 5. But Y can't be X. 2) Based on the input, I will have more fields added to the calculation. Let's say if X = 3 and Y = 1, I will have 3 fields related to X and 1 field related to Y. 3) After that, the user will fill in these 4 fields (3+1)  and I need to find the sum of the last two numbers by which 3 is greater than 1. That is, in this case, the sum of the last two fields. Or let's say If X is 4 and Y is 1, then I need to find the sum of the last THREE values.

Making the Best WordPress Plugin even better - Together

Take on bigger projects with confidence knowing you have access to an entire community of Formidable Experts and Professionals who have your back when the going gets tough. You got this!
Join the community
crossarrow-right