Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Pull letters from text fields and calculate result

Status
Not open for further replies.

panorama

Technical User
May 22, 2011
1
Hi,

I have text fields numbered Txt900 thru to Txt980. I am trying to adapt the following formula (without Luck) to pull out the letters MG,SW,MI,CW out of the text fields and sum them.

The user would be entering in the text fields MI-20000-455 or CW-45000555-99 0r 99-0000000-12, variation of numerals, but the one constant is the MI CW MG SW
So I need to count the instances of them if possible?

var sum = 0;

// Loop through the input fields
for (var i = .900; i < .980; i++)
{
if (getField("Txt" + i).valueAsString === "MI")
{
var num = getField("Text." + i).value;
sum += Number(num);
}
// Set this field value equal to the sum
event.value = sum;}

Any ideas how to do this....

Cheers Stephen

acrobat 10.01 windows
Top

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top