Print Page | Close Window

calculate sum only with positive valus

Printed From: Foxit's Planet PDF Forum
Category: Lets Talk PDF
Forum Name: [Commercial] Adobe LiveCycle Designer Forms
Forum Description: Discussions relating to Adobe LiveCycle Designer and XFA forms.
URL: http://forums.planetpdf.com/forum_posts.asp?TID=1912
Printed Date: 17 Jun 2019 at 7:58pm
Software Version: Web Wiz Forums 11.10 - http://www.webwizforums.com


Topic: calculate sum only with positive valus
Posted By: ilnobile
Subject: calculate sum only with positive valus
Date Posted: 12 Jan 2016 at 8:39am
Hi there,
I'm a dummy and I need an help to calculate a sum of three fields of trhee different forms only if there values are positive.
I try put this code on the calculate event of the textfield that should contain the sum:

if(Subform34.valore11.rawValue>0){
this.rawValue = this.rawValue + Subform34.valore11.rawValue;
}

if(Subform36.valore11.rawValue>0){
this.rawValue = this.rawValue + Subform36.valore11.rawValue;
}

if(Subform37.valore11.rawValue>0){
this.rawValue =this.rawValue + Subform37.valore11.rawValue;
}

it doesn't works 
someone can help me please?




Replies:
Posted By: gkaiseril
Date Posted: 12 Jan 2016 at 10:00pm
You might want to recheck the Scripting reference included in LiveCycle.

I would not use "this", since the word "this" defines the document object.

For the current field's value I have only seen "$.rawValue".


Posted By: ilnobile
Date Posted: 13 Jan 2016 at 7:12am
many thanks for the answer,
I solved the problem with this code that works well:
var v = 0;

if(Subform34.valore11.rawValue > 0){
    v = v + Subform34.valore11.rawValue;
}

if(Subform36.valore11.rawValue > 0){
    v = v + Subform36.valore11.rawValue;
}

if(Subform37.valore11.rawValue > 0){
    v = v + Subform37.valore11.rawValue;
}

this.rawValue = v;



Print Page | Close Window

Forum Software by Web Wiz Forums® version 11.10 - http://www.webwizforums.com
Copyright ©2001-2017 Web Wiz Ltd. - https://www.webwiz.net