Quantcast
Channel: Adobe Community : All Content - LiveCycle Designer
Viewing all articles
Browse latest Browse all 5571

Is it possible to get multiple values from a script object to calculate a total in a field?

$
0
0

I have a script object that populates fields.  There are two arrays, one for dates and one for values.

 

Snippet of script object:

//Array of closing dates.

var closingDate =new Array("",

"1/3/2011",

"1/4/2011",

"1/5/2011",

etc……

"12/31/2016");

 

//Array of closing values.

var closingValue =new Array(null,

"1271.89",

"1270.2",

"1276.56",

etc……

"1848.36");

 

//Populate the Closing Value fields

function getValue(ClosingDate, ClosingValue)

{

    var i;

    for (i = 0; i < closingDate.length; i++)

 

    {

 

        if (closingDate[i] == ClosingDate)

        {

            ClosingValue.rawValue = closingValue[i];

            break;

        }

    }

}

 

Only certain dates and values are displayed in the form.  The other dates and values are needed to calculate values during the year.  For instance, there is a field with the date of 1/3/2011 and another populated with the value of 1271.89; a field with 1/3/2012 and another populated with a value of 1227.06 (from the script object).  I would like a field to calculate the values between 1/3/2011 and 1/3/2012. I don’t want to have a field for each date between 1/3/2011 and 1/3/2012 and fields for each value because I would have hundreds of fields for dates and hundreds of fields for values.  Is there a way to pull multiple values from the script object and then add them together to display the total in a field?


Viewing all articles
Browse latest Browse all 5571

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>