calculation of totals: if, else statements

OK, I have a form with 7 fields called receipt1 by the receipt7. I'm also a total field called reimbursementTotal.

I need a script to add all the fields of reception to the top and if the total is less than or equal to $150, enhance the reimbursementTotal of the total field, otherwise give the reimbursementTotal a value of $150.

I'm not very versed in Adobe Scripting, some help would be appreciated.

Thank you

WTM

Try following the calculation script customized for the text reimbursementTotal field:

Custom calculation script

(function () {}

To calculate the total

var total = 0;

for (var i = 1, I< 8,="" i++)="">

Total += + getField("receipt"_+_i).value;

}

Set this field value based on the total

Event.Value = (total > 150)? 150: total;

})();

Tags: Acrobat

Similar Questions

  • If the Else statement in the Validation of the values of other fields

    Thanks in advance for your help.

    Here is the statement:

    $3,000 (maximum)

    OR my remaining balance $ (field remaining balance)

    $ (total field)

    The maximum that the user can contribute is $ 3,000. If they enter a number greater than $3,000 for the balance, the total amount for this declaration should be $3,000. If they enter a number less than $3,000 for other balance, the total for that statement should be the number entered for the balance.

    I think I'm actually making it harder than it needs to be. I would like that the total field to evaluate user input in the field balance; If this number is large than.3, 000, the total is 3,000; If this is not the case, the field total is equal to the value entered in the balance field.

    Thanks again for your help.

    Gilad D (try67) wrote:

    There are two problems with your code:

    1. in a computation script we should apply the new value using event.value, not not not using the getField method.

    2. you must convert the value to 'Balance' a number explicitly.

    So the code should:

    var b = number (this.getField("Remaining_Balance").value);

    If {(b > 3000)

    Event.Value = 3000;

    } else event.value = b;

    I see, thank you Gilad.

  • If else statements

    Hello world!

    I cannot re written one "if else" statement of Excel in ActionScript 3. Maybe someone can tell me what am I translated badly in the new formula of AS3.

    The original argument of Excel is:

    =IF(AND(F8<=5,F39>=10),10,IF(AND(F8<=5,F39<10),F39,IF(AND(F8>=6,F8<=10,F39>30),30,IF(AND(F8>=6,F8<=10,F39<=30),F39,IF(AND(F8>10,F39<30),F39,30)))))

    I translated this into AS3 as follows:

    if(q1_preCalc <= 5 && q13_preCalc >= 10)
         {
              q13_preCalc = 10;
         }else if ( q1_preCalc <= 5 && q13_preCalc < 10)
         {
              q13_preCalc = q13_preCalc;
         }else if (q1_preCalc >= 6 && q1_preCalc <= 10 && q13_preCalc > 30)
         {
              q13_preCalc = 30;
         }else if (q1_preCalc >= 6 && q1_preCalc <= 10 && q13_preCalc <= 30)
         {
              q13_preCalc = q13_preCalc;
         }else if (q1_preCalc > 10 && q13_preCalc < 30)
         {
              q13_preCalc = 30;
         }else
         {
              q13_preCalc = 30;
         }

    As you can see, I'm trying to set the vaule of the variable "q13_preCalc" according to the value of 2 other variable: q1_preCalc and q13_preCalc (himself).

    After you set the value, I do the calculation with the value:

    q13_preCalc_2 = (q13_preCalc*0.01)*-2.787;

    I don't know if I translate the "If another 'instructions properly in AS3 since Excel."

    Thank you in advance for your help!

    Rafa.

    It seems correct to me, just the last part is different:

    IF (AND (F8 > 10, F39<>

    but in AS3 you wrote:

    If (q1_preCalc > 10 & q13_preCalc)<>
    {
    q13_preCalc = 30;

    ...

    }

    and I see in your AS3 to 2 variables: q1_preCalc, q13_preCalc

    Where is the 3. ?

    in Excel, you have 3 cells (values): F8, F39 and the cell containing the formula.

  • JavaScript custom for If/Then/Else statement code

    Can someone help me understand this code. I have a field in a PDF file that I need to generate a discount based on the price of an item. If the price is higher than 5000, then I need the field to say 1500. Otherwise the field discount must be price *. 30.

    I tried, but it did not work: if price > 5000 then discount = discount 1500 = price*.3

    Someone at - it help?

    Thank you!

    Acrobat forms use JavaScript, so you need to use the JavaScirpt syntax for JavaScript syntax appropriate for the 'If... else' statement. You will also need to access the domain object as established by the Acrobat JavaScript object using the method "getField" of the doc, "this.getField (cName)" object, then the property "value" for this object.

    custom calculation script for the ' discount field

    establish the name of the price field

    var c = "price";

    get the value of the price field

    var nPrice = this.getField (c) .vallue;

    Assume that the discount is 30% of the price

    NPrice = Event.Value * 0,30;

    the value of reduction 1 500 if the price is higher to 5,000

    If {(nPrice > 5000)

    Event.Value = 1500;

    }

    end of the custom calculation script

    For more information, see Conditional Execution by Thom Parker.

  • If/else statement in the MathScript node

    I want to write if/else statement in MathScript node.

    If (Yes is Yes)

    {

    a = 0;

    }

    other (no = no)

    {

    b = 1;

    }

    'Yes' and 'No'--> of Type String

    'a' and 'b'--> Type Double

    Hi johndoe.

    Thank you for contacting National instruments.

    I would like to highlight a number of items which you may find useful for the implementation of an if-else statement in a MathScript node.  The first is a book white tutorial, which the second part explains how to use LabVIEW MathScript node. The second is an article describing the required syntax to write functions and scripts in the MathScript node, including instructions for the use of the If-Else statements.

    I hope that these help. Please let me know if you need additional assistance.

    Kind regards

    James

  • OATS: script entering does not in the if-else statements

    I created a functional test using Oracle's Web. My database file (.csv) contains a number of numbers that are used to browse through the script with different values. now in my loop for, I have included an if-else with action statements in these (Actions like) by clicking on the different tabs. Now, when I run my script, is to not enter the if-else statement and jumping directly to the next step.

    Here are my script:

    beginStep ("search page", 5)

    {page opening}

    String Var1 = (string) 'value from the .csv data bank ";

    for (int i = 1; i < = 2; i ++)

    {

    beginstep("/ASC",0)

    {

    if(var1=="ABC")

    {

    Task1;

    Task2;

    }

    ElseIf (Var1 == "efg")

    {

    Task1;

    Task2 ;}

    }

    }

    endStep();

    beginStep("/asc",0)

    {

    Task3;

    Task4;

    }

    endStep();

    }

    According to my above script, the script is to jump directly to TAsk3 and 4, instead of going to task if-else performing 1 and 2.

    Thanks in advance.

    Kind regards

    Deepak Khari

    Hello

    Use eval(), c.


    String Var1 = eval ("{{db. Var1.ColumnName}} ")." ToString();

    System.out.println ("scnro_class--->" + Var1);


    Kind regards

    Dembélé M

  • How to use an IF ELSE statement and the xdoxslt: get_variable together?

    First of all, I'm a big fan of this forum and I would like to thank the community for helping to make better the world BI Publisher.

    I'm trying to populate a table with a value of years of data with column = PRODUCT and row = month to DATE. Here's the catch, not every month will be given. Then here's where is my problem, I am not able to use an IF ELSE statement with an expression XDOXSLT:GET_VARIABLE so that if there is no given for this month the default value will be 0.

    Can someone help me find a solution to one of the attempts below or a method entirely new? Thank you!

    BP4 = numeric value of months with a DATE (more code to extract only the month DATE not included here)
    JAN1 = PRICE if there is data, 0 otherwise

    (1) I tried and it did not work:
    <? If: xdoxslt:get_variable($_XDOCTX,'BP4'), 01 xdoxslt:set_variable($_XDOCTX,_'JAN1',PRICE) then another end if xdoxslt:set_variable($_XDOCTX,_'JAN1',0)? >
    <? xdoxslt:get_variable($_XDOCTX,'JAN1')? >
    <? end if? >

    (2) I tried and it did not work:
    <? xdoxslt:IfElse (xdoxslt:get_variable($_XDOCTX,'BP4') = '01', xdoxslt:set_variable($_XDOCTX,_'JAN1',PRICE), xdoxslt:set_variable($_XDOCTX,_'JAN1',0))? >
    <? xdoxslt:get_variable($_XDOCTX,'JAN1')? >
    <? end if? >

    (3) I tried and it did not work:
    <? xdofx:If xdoxslt:get_variable($_XDOCTX,'BP4') = '01' xdoxslt:set_variable($_XDOCTX,_'JAN1',PRICE) then another end if xdoxslt:set_variable($_XDOCTX,_'JAN1',0)? >
    <? xdoxslt:get_variable($_XDOCTX,'JAN1')? >
    <? end if? >

    example of XML data:
    < ROW >
    < name > Craig Hernandez < / NAME >
    < DATE > 2013 - 01-01 T 00: 00:00.000 + 08:00 < / DATE >
    < PRICE > 31 < / PRICE >
    BPD of < PRODUCT > < / PRODUCT >
    < / ROW >


    -TRD

    Published by: 990965 on February 28, 2013 08:27

    >
    (1) I tried and it did not work:


    (2) I tried and it did not work:


    (3) I tried and it did not work:


    >
    so

    
    
    

    works for me, it's

  • hide and show the icon view using if else statement

    is - it possibleto hide and expose the display icon using if else statement? I try to use erase them but I don't know how show it on again after that I want to come back. Thank you

    There are two functions... EraseIcon and Exposeicon

    Mike

  • If and Else statements? Help!

    I am a dress up game in Adobe Flash 8 (AS2) and I am trying to Show and hide multiple video Clips on the release of a button to sort of a menu like this:


    http://charfade.deviantart.com/art/dress-up-NALA-game-107105062


    Its probably if/else statements, but I do not know how their code in ActionScript 2 , so it could very well help if you had a response

    You can use the movieclips _visible property to show (mc._visible = true) and hide (mc._visible = false) a movieclip mc.

  • If an else statement does not

    I'm sure have the conditions and statements typed in wrong. Here is the original code:

    Stop();

    var my_timedReveal:Number = setTimeout (my_delayedReveal, 15000: 1);

    function my_delayedReveal (arg1) {}
    gotoAndPlay ("reveal2");
    }

    cardA .mouse .addListener (mouseDown);
    cardB.Mouse.addListener (mouseDown);
    cardC.Mouse.addListener (mouseDown);

    cardA.onRelease = function() {}
    gotoAndPlay ("reveal1");
    }

    cardB.onRelease = function() {}
    gotoAndPlay ("reveal2");
    }

    cardC.onRelease = function() {}
    gotoAndPlay ("reveal3");
    }

    only now, I want to add an if/else statement so that if none of the mouseDown conditions are met, it will then the variable timeout:

    I have not tried or no this result:

    var my_timedReveal:Number = setTimeout (my_delayedReveal, 15000: 1);

    If (cardA .mouseDown = true) {}
    gotoAndStop ("reveal2")
    }

    else {}
    my_delayedReveal = true;
    }

    What Miss me? Am I even close?

    I have not tried to reason with your code, but when you compare things to equal you use is, not =

    If (cardA .mouseDown == true) {}

    And in the case of a boolean comparison, like that you can just use...

    If {(cardA .mouseDown)

    So see if what you're trying or could have tried to work when you use the comparison properly.

  • PHP if else statement

    If ($_SESSION ["FirstName"] == "") AND ($_SESSION ['name'] == ' ') {}

    AND is not correct... what would I use to have an if else statement that has more then a variable as the fi part?

    If ($_SESSION ["FirstName"] == "" & $_SESSION ['name'] == ' ') {}

  • IF and ELSE statements

    The man... I'm so close to figure this out and I didn't have to go back on the forum for this because I had a few topics here already when I started this project and to halfway through it and now towards the end of it, LOL! I hope that you all don't mind!

    in any case...

    Now I am trying to get users to fill out 4 boxes with the correct information, then press the ENTER key to go to the next section. Everything works perfectly with this part of my code, however, it is the part on whether they enter the wrong info that I be puzzled over.

    I tried the ELSE statements and various forms of listeners and IF statements, but I can't seem to make it work.

    When they enter the wrong info, in the entry boxes, I have to be taken to a different image. I had a script in there little worked, but instead of him awaiting until they entered all the information, it would just automatically go to the 'wrong' because technically, they received only a chance to enter the first letter of the first word.

    in any case, the code that I use now is attached. It works very well except the part of the erroneous info being entered. If a user has just this framework (where the code is located) and hits ENTER, thn, they are taken as part of 'Wrong', which is good, because technically they do not capture in 4 boxes. But. If they start typing in a box and then press ENTER, they need the same "Incorrect" framework because they have not all enter, but it is not that. Even if they conclude each info box and a letter is missing for example, which is wrong and should go to this 'Wrong' page, but is not.

    Any ideas?

    It is strange.so your code looks like this (and all the other stuff that was already there?):

    If (Key.isDown (Key.ENTER)) {}
    trace ("talk to the hand, because I'm no longer listening.");
    Key.removeListener (listener);
    trace ("the time it was the Enter key, then I should evaluate.");
    Evaluate();
    }

    It should work. I just tested it and it works for me. Well, it worked on the second try, the first time that I misspelled "listner", so be sure that you have spelled everything correctly!

    Unless you are sure that it is the function of battery called? How do you know? Y at - he got another code which could be initially move the playback cursor?

    BTW, if you use Actionscript, you shouldn't use scenes. There are strange things that occur with it and it is not worth!

  • If an else statement not calculation in pdf format. Help!

    This formula (see below) does not (calculation) result.  What's wrong?

    var a = this.getField ("Positions_Rates");

    var b = this.getField ("Positions");

    If (a.value == '$0 - no position not bought') {}

    (b.value = 0);

    } ElseIf (a.value == $40 Top position 'bought') {}

    (b.value = 40);

    } else {}

    (b.value = 1);

    }

    Then, you must use "event.value" instead of "b.value.

  • So then the Else statement does not not under calculation in APEX

    Hello

    Can someone help me where I'm wrong? I try to use the following code in the calculation process on submit. I'm not able to get the value. It shows nothing.

    *

    Point calculation

    Top

    *

    Source

    Top

    *

    BEGIN

    IF: P3_AGING_DAYS < = '0' THEN

    : P3_AGING_BUCKET: = 'to breast due date';

    elsif: P3_AGING_DAYS > AND '0': P3_AGING_DAYS < = "3" then

    : P3_AGING_BUCKET: = 'within 3 days.

    end if;

    end;

    1efb2968-171D-43f9-9d5d-d38151735ed7 wrote:

    Please update your forum profile with a real handle instead of '1efb2968-171d-43f9-9d5d-d38151735ed7 '.

    Can someone help me where I'm wrong? I try to use the following code in the calculation process on submit. I'm not able to get the value. It shows nothing.

    BEGIN

    IF: P3_AGING_DAYS<= '0'="">

    : P3_AGING_BUCKET: = 'to breast due date';

    elsif: P3_AGING_DAYS > AND '0': P3_AGING_DAYS<= '3'="">

    : P3_AGING_BUCKET: = 'within 3 days.

    end if;

    end;

    A calculation of body of the PL/SQL function must return a value, rather than to assign to an element in the PL/SQL block (APEX turns the block in the body of a function). The element for which the value should be calculated is specified in the properties of computation (P3_AGING_BUCKET).

    begin
      return case
               when :p3_aging_days < 1
               then
                 'Within due date'
               when :p3_aging_days between 1 and 3
               then
                 'Within 3 days'
             end;
    end;
    
  • Conditional if... else statements populate another field

    Hello

    new to the forum. A big shout out to all those who help people like me. It is greatly appreciated not only to solve the problem but helps us to learn as well.

    I looked at other issues and don't quite understand what I'm looking for. Java script seems to make up my mind what the...

    Scenario:

    I have a form of credit card and I want to calculate a surcharge on the transaction amount.

    Type of card ("card" field) is chosen from a drop-down list and the value can either be Visa, MC or Amex, with export value of 1, 2 or 3 respectively.

    The amount of the transaction is entered in the field "amount". At the exit of the "amount" box, I want the "supplement" to be automatically populated with a calculation field. This calculation is:

    If 'card' = 1 then 'supplement' = 'to' *.01

    on the other

    If 'card' = 2 then 'supplement' = 'to' *.03

    on the other

    If 'card' = 3 then 'supplement' = 'to' *.05

    I have one more field 'total' that will be the value of the sum "amount", "Supplement".

    The other part is if the wrong card was first chosen (for example the seller chose Visa but it should have been Amex) I would like to as the field "supplement" to recalculate automatically at the exit of this field.

    Any assistance, advice would be greatly appreciated.

    Thank you

    Kudurider

    You can use this code as the custom to "subcharge": calculation script

    var card = this.getField("card").valueAsString;
    var amount = Number(this.getField("amount").valueAsString);
    if (card=="1") event.value = amount*0.01;
    else if (card=="2") event.value = amount*0.03;
    else if (card=="3") event.value = amount*0.05;
    else event.value = "";
    

Maybe you are looking for