calculation in adobe livecycle

mohama32406181

27-06-2016

i had made a form using adobe livecylce designer ES2 and i want to get the standard deviation for a multiple numeric cells values.. in adobe acrobate i was using this javascript

var MyValues = new Array();

var MyFields = new Array("F0VerHR", "F1VerHR", "F1secondVerHR", "F2VerHR", "F3VerHR");

var oField;

var nField;

for(var i = 0; i < MyFields.length; i++)

{

  nField = '';

  nField = GetField(this, MyFields[i]).valueAsString;

  if(nField != "") MyValues.push(Number(nField));

}

event.value = standardDeviation(MyValues);

but this code dose not work with livecycle designer.. can you help me please in the correct code

thanks alot

Accepted Solutions (0)

Answers (3)

Answers (3)

mohama32406181

12-09-2016

please I have another question:

I have 5 numeric fields in table and I want to get the average of these 5 fields

I have used this FormCalc

( Avg(Table7.Row1[1].F0VerHeightRatio, Table7.Row1[3].F1VerHeightRatio, Table7.Row1[5].F1secondVerHeightRatio, Table7.Row1[7].F2VerHeightRatio, Table7.Row1[9].F3VerHeightRatio)

but I want to exclude from average any one of this fields that is equal to zero or empty

{ or another idea:    if the state of these fields is visible then include it in the average -- but if state of one of these fields is not visible then exclude it from average) as the fields that I don't used is usually in an invisible status

please I need help it is very important for me

thanks

radzmar

MVP

06-07-2016

Err, not sure I understood what your're after.

This script will look for the fields listed in MyFields and will save their values into the array MyValues.

var MyValues = [],

  MyFields = ["F0VerHR", "F1VerHR", "F1secondVerHR", "F2VerHR", "F3VerHR"];

MyFields.forEach(function (element) {

  var oNode = xfa.resolveNode(element);

  MyValues.push(oNode.rawValue);

});

/* Now do something with the results */

xfa.host.messageBox(MyValues.join("\n"));