Page 1 of 1

Master and Detail add auto compute qty based on input from January to December

Posted: Mon Mar 25, 2024 1:23 pm
by JAYM

Master and Detail add auto compute qty based on input from January to December

I have this detail add table where i want the qty to auto compute based on the input fields January to December.
this occurs when adding on master and detail add.

Thanks for your Help.


Re: Master and Detail add auto compute qty based on input from January to December

Posted: Mon Mar 25, 2024 5:10 pm
by arbei

You may use Client Side Events for the quantity fields, your "change" handler should all inputs for all months and them sum the values up. Try and write your code, if it does not work, you may post for discussion.


Re: Master and Detail add auto compute qty based on input from January to December

Posted: Tue Mar 26, 2024 1:45 pm
by JAYM

To test it I put this code to the qty client side event but still does not work

{ // keys = event types, values = handler functions
	"change": function(e) {
		var $row = $(this).fields(); // Get an object of all fields, each property is a jQuery object of the input element(s) of a field
        var st = $row["jan"].toNumber() + $row["feb"].toNumber(); // Convert to number and calculate
        $row["qty"].value(st); // Set result to a field
	}
}

Re: Master and Detail add auto compute qty based on input from January to December

Posted: Tue Mar 26, 2024 2:16 pm
by arbei

Your code implies that:

  1. The fields "jan", "feb", and "qty" are all in the same row.
  2. You add your listener to the "qty" field, it will only be triggered when you change the "qty" and then it updates itself.
    Are you sure it is correct?

Re: Master and Detail add auto compute qty based on input from January to December

Posted: Tue Mar 26, 2024 2:38 pm
by JAYM

I change the "change" to "keyup" now its working.. thank you for your help thanks a Lot