This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

APPLICATION - PRODUCT ENGINEERING - Field calculated from other fields

Matt65 - Friday, October 8, 2010 5:03 PM:

I need to be able to calculate a field based on other fields.  For example, if I have a net weight and a packaging weight, I want my this: gross weight = net weight + packaging weight.  How do I go about creating that new field.  I am just getting my feet wet in Aras so I'll need step by step instructions on how to do this. Thanks.



Brian - Monday, October 11, 2010 6:46 AM:

HI Matt,

Not sure how wet your feet are yet.

Let's assume you have a form with three fields named: gross_weight, net_weight, packaging_weight. These are also the names of the properties in your item that are the data sources for the fields.

On each of the two fields that are part of your sum you want to put a Field Event called "SumOfWeights" which is called on the "onChange" event of both of the fields.

The Javascript code should be something like:

var netWeightFld = document.getElementsByName("net_Weight");

var packWeightFld = document.getElementsByName("packaging_weight);

var grossWeightFld = document.getElementsByName("gross_weight");

var netWeightVal = netWeightFld[0].value;

var packWeightVal = packWeightFld[0].value;

var grossWeightVal = parseFloat(netWeightVal) + parseFloat(packWeightVal);

grossWeightFld[0].value = grossWeightVal.toString();

return this;

 

Whenever one of the fields that makes up the sum is changed the sum will be re-calculated. Make the field visible but disabled and when you save the item the three field values will save to the data table.

Hope this helps,

Brian.

 



xueron564 - Sunday, August 14, 2011 8:53 PM:

888xuerong-3:

They say that jewels are the best friends a lady would seek. Jewels will help to beautify the lady before you. So, if you love your girl, give her Jewellery Funs for her next coming birthday. Another lovely present that she would love too, would be the Louboutin Shoes which has been proved to be the shoe that can make her legs look slender, making her look sexier. If you are thinking of what shoes to buy for your teenage boy, I would suggest the Supra Shoes UK as it is a combination of fashion and good quality. Ask any teenage boy on the street and they would put their thumbs up for this shoe. Of course, the Nike Shoes Sale is the never ending hot topic among the presents for the birthdays. The Nike shoes has won the heart of many people, the young and old alike. Last, there is the Cheap North Face which is the most suitable clothes to wear, if you are thinking of having a trip outdoors.fd

 



Fantomas - Friday, November 5, 2010 6:38 AM:

Yeah, you wrote the Javascript code for this, but isn't there an option we can click on directly on Aras to do this sum?

For example, we have two different fields in a base, and we create a third one and want it to equal ro the sum of the two previous ones... (just like Excel does actually)

I haven't downloaded Aras yet by the way. This was just a small question I wanted to ask out of curiosity...

Thanks