Expand my Community achievements bar.

calculation in adobe livecycle

Avatar

Level 1

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

3 Replies

Avatar

Level 10

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"));

Avatar

Level 1

Hello, I tried this script but I does not work

Avatar

Level 1

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