Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn More

View all

Sign in to view all badges

about standard deviation

Avatar

Avatar
Level 1
mea77
Level 1

Likes

0 likes

Total Posts

5 posts

Correct Reply

0 solutions
View profile

Avatar
Level 1
mea77
Level 1

Likes

0 likes

Total Posts

5 posts

Correct Reply

0 solutions
View profile
mea77
Level 1

11-06-2016

Please Dear..

i have used adobe livecycle designer Es2 for making form, i want to calculate the standard deviation for 5 feilds named (F1,F2,F3,F4,F5) which is numeric and i think that this can be done through a custom calculating script.. can you help me please in a code to perform this calculation... the previous was in adobe acrobat pro but when use the same code it does not work with adobe livecycle designer.. please help me in this issue

thsi was the code that i use in adobe acrobat pro:

var MyValues = new Array();

var MyFields = new Array("F1", "F2", "F3", "F4", "F5");

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

so i need code perform the same function for adobe livecycle designer

thank you

Accepted Solutions (0)

Answers (4)

Answers (4)

Avatar

Avatar
Boost 5
Level 7
gkaiseril
Level 7

Likes

13 likes

Total Posts

456 posts

Correct Reply

2 solutions
Top badges earned
Boost 5
Boost 3
Boost 10
Boost 1
Applaud 5
View profile

Avatar
Boost 5
Level 7
gkaiseril
Level 7

Likes

13 likes

Total Posts

456 posts

Correct Reply

2 solutions
Top badges earned
Boost 5
Boost 3
Boost 10
Boost 1
Applaud 5
View profile
gkaiseril
Level 7

17-06-2016

I would put the functions at the document level so they would be available to any form field in the PDF. If one is computing the standard deviation the average moght also be in another field.

Avatar

Avatar
Boost 50
MVP
_Bruce_Robertson
MVP

Likes

269 likes

Total Posts

1,782 posts

Correct Reply

372 solutions
Top badges earned
Boost 50
Boost 5
Boost 3
Boost 250
Boost 25
View profile

Avatar
Boost 50
MVP
_Bruce_Robertson
MVP

Likes

269 likes

Total Posts

1,782 posts

Correct Reply

372 solutions
Top badges earned
Boost 50
Boost 5
Boost 3
Boost 250
Boost 25
View profile
_Bruce_Robertson
MVP

17-06-2016

Hi,

Try this;

function average(data) {

    var sum = data.reduce(function (sum, value) { return sum + value; }, 0);

    var avg = sum / data.length;

    return avg;

}

function standardDeviation(values) {

    var avg = average(values);

    var squareDiffs = values.map(function (value) { var diff = value - avg; var sqrDiff = diff * diff; return sqrDiff; });

    var avgSquareDiff = average(squareDiffs);

    var stdDev = Math.sqrt(avgSquareDiff);

    return stdDev;

}

var MyValues = new Array();

var MyFields = new Array("F1", "F2", "F3", "F4", "F5");

var oField;

var nField;

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

{

  nField = '';

  nField = xfa.resolveNode(MyFields[i]).rawValue;

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

}

standardDeviation(MyValues);

Regards

Bruce

Avatar

Avatar
Level 1
mea77
Level 1

Likes

0 likes

Total Posts

5 posts

Correct Reply

0 solutions
View profile

Avatar
Level 1
mea77
Level 1

Likes

0 likes

Total Posts

5 posts

Correct Reply

0 solutions
View profile
mea77
Level 1

11-06-2016

Hello, i try to find it but i cant

please guide me

thanks

Avatar

Avatar
Boost 5
Level 7
gkaiseril
Level 7

Likes

13 likes

Total Posts

456 posts

Correct Reply

2 solutions
Top badges earned
Boost 5
Boost 3
Boost 10
Boost 1
Applaud 5
View profile

Avatar
Boost 5
Level 7
gkaiseril
Level 7

Likes

13 likes

Total Posts

456 posts

Correct Reply

2 solutions
Top badges earned
Boost 5
Boost 3
Boost 10
Boost 1
Applaud 5
View profile
gkaiseril
Level 7

11-06-2016

The code for the function "standardDeviation" is placed in a document level JavaScript object. This is a user written function.

The documentation under Help in LiveCycle has documentation on how to do this and convert the JavaScript for the field to FormCalc or JavaScript.