Simple If-Then statement

Hello

I am working on a form and I have a question related to three areas: V1, V3 and V4. I want V4 to be the product of V1 and V3, if these values are met. If this isn't the case, I want to be able to manually put a number in V4.

I have searched and tried different different if, so that statements, but none seem to work. Help, please!

Thank you very much

Amanda

Another idea would be to use a single field and calculate the value of the script format. Try something like this to see if it works:

var v1 = this.getField('V1').valueAsString

var v2 = this.getField('V3').valueAsString

If (v1 == "& v2 ==") {}

event.target.readOnly = false

} else {}

var prod = / /... do your math here

event.target.readOnly = true

Event.Value = prod

}

Tags: Acrobat

Similar Questions

  • Need help with simple if/then script

    I'm trying to replicate a simple if/then statement excel in a PDF form. Have tried several things, but am just not a scripter Java.  The hope that I could get help from the community.

    I have three boxes that contain information on costs. They are labeled LaborCost, MaterialCost & EquipmentCost. Later, in the form, I have two boxes of different output for the sum out of my first three boxes.  If it's a positive number and the other is a negative number.  In Excel forumla language, that's what each of the boxes would read as:

    For the 1st result if it is a positive number: @if (+ LaborCost + MaterialCost + EquipmentCost > 0, + LaborCost + MaterialCost + EquipmentCost, 0)

    For the 2nd result if it is a negative number: @if (+ LaborCost + MaterialCost + EquipmentCost < 0, + LaborCost + MaterialCost + EquipmentCost, 0)

    I think that this should be a simple thing to write, but I'm not familiar with the games of the appropriate language.

    Your colletive help is VERY appreciated.

    Steven

    Try following the calculation script customized:

    // Sum the field values, as numbers
    var sum = +getField("LaborCost").value;
    sum += +getField("MaterialCost").value;
    sum += +getField("EquipmentCost").value;
    
    // Set this field value
    event.value = sum > 0 ? sum : 0;
    

    For others, change the last line:

    Event.Value = sum< 0="" sum="" :="">

  • If/then statement

    I am designing a form that has 2 columns and I am looking for a script to fill a column based on data in the other.  Specifically, if classes has, B, C, D are entered in the column on the left, then the right column filled with 3 hours of credit.

    I took a fairly simple if/then statement... Found one in the help section of my software, plugged, named fields properly in the object palette and in the script.  No go.

    Book Terry JT not useful and my computer is not versed in Java.

    Or, maybe I'm doing it too hard and FormCalc would be the right choice?

    Thank you!

    Hi Milly,.

    You didn't say what else is in the grade or the opportunities that lay is A +, B-, etc. AND they are in a table row. I suppose they are in a table. I think on a drop-down list for the grade box. That said, this might work for a drop-down list box or a text field containing the grade (depending on how you have the menu drop-down set up) or this script is changed for a drop-down list containing the digital item values in the 'Connection' tab easily. It lends itself to the computer GPA (if it is an ultimate goal).

    Grade Credit
    A 3
    C 3
    F 0
    A 3

    The script is quite easy.

    Make sure you place this on the calculate of the "credit" field event AND formCalc is the language:

    ////////////////////////////

    If (rank< "f")     ="">

    $ = 3

    on the other

    $ = 0

    endif

    ////////////////////////////

    If there is + or - grades, you could use

    ////////////////////////////

    If (Substr (grade, 1, 1)<  "f")     ="">

    $ = 3

    on the other

    $ = 0

    endif

    ////////////////////////////

    La: Substr(grade,1,1) from the 1st letter of the slope and uses for comparison

    Replace with the name of your field of rank for the "rank" above and you should be good to go.

    Good luck

    Stephen

  • How to do an if then statement on a PDF form

    I'm doing an if then statement on a PDF form.

    The field is a field A * B = C.  If C < 10 then C = 10, of another C = A * B

    How can I write the Adobe Pro is on a PDF form?  I went into properties, the calculated field and nothing I've tried works.

    Each field is a separate object, so if you have 3 fields such as 'A', 'B' and 'C' are a single object has a unique value. Each field must be consulted individually, you should get the value in field "A" in a statement, the value of the field 'B' in another statement.

    var C = this.getField ('A') .value * this.getField("B").value;

    If (C)< 10="" )="" event.value="">

    else event.value = C;

    You can see more clearly with code like:

    var A = this.getField ('A') .value; the value of a field;

    var B = this.getField ('B') .value; the value of field B;

    var C = A * B; the field value has multiplied by the value of the field B;

    If (C)< 10="" )="">

    Event.Value = 10; the value is 10 when produced less than 10;

    } else {[]}

    Event.Value = C; another value is the product;

    }

  • If then statements

    Greetings,

    I use Adobe Acrobat Pro XI.  I have a drop down list which has the value 'Yes' or 'No' I would like to create an If Then statement to return specific values in another field of text based on the value of the drop-down list box.  Specifically, if the value of the 'drop-down list' = 'no', then the value of the "textfield2' will be 'n/a '.  If the value of the drop-down list is 'Yes', then the value of the "textfield2" remains empty if the applicant can enter data into "textfield2.

    Hope it makes sense.  Thank you in advance.

    Steve

    Use this code in the script validation custom from the drop-down list:

    If (event.value == "No") this.getField("textfield2").value = "n/a";

    else this.getField("textfield2").value = "";

    Make sure that check the option to validate the value selected from the drop-down list immediately (under Properties - Options).

  • If/Then statement to date null in Acrobat DC

    I work in Acrobat DC, I have a document which is 6 pages long, the first page is in English, the other in Spanish.

    I have two date fields, one is named AssessmentDate and the other is LongAssessDate. AssessmentDate displays the date in English in mm/dd/yy format on the first page.

    The LongAssessDate field converts the date in the field of the AssessmentDate in a Spanish format. For example if the Valuation Date
    24/05/15 then the date is converted to this format = 24 Mayo of 2015.

    Here is my code:

    oField var = this.getField ("AssessmentDate");

    oDateObject = util.scand ("mm/dd/yy", oField.valueAsString);

    Event.Value = util.printd ("date (es) {DD ' of 'MMMM' to ' YYYY}", oDateObject, true);

    What I found is, if the user does not have a date in the AssessmentDate field (they leave empty), the current date watch in the
    Field of LongAssessDate.

    I think I need an if/then statement for the LongAssessDate field. If the value of AssessmentDate is null or empty, then the LongAssessDate field must be null/empty, but don't know how to proceed. Any help is greatly appreciated.

    Thank you, Jamie

    This should work:

    var sDate = this.getField("AssessmentDate").valueAsString;

    If (sDate) {}

    oDateObject = util.scand ("mm/dd/yy", sDate);

    Event.Value = util.printd ("date (es) {DD ' of 'MMMM' to ' YYYY}", oDateObject, true);

    } else {}

    Event.Value = "";

    }

  • New on Adobe need help with an if then statement

    Hi, I really like what ADOBE Pro 9 can do with forms and neat and everything is included.

    I'm having a problem trying to understand an if then statement for one of my forms and how to make it executable.

    Here is what I have

    I.          Cigna Medical                                           

                (10)       single                                     $  44.00

                (11)       Employee & Child (ren)              $  82.00          

                (12)       Employee & Spouse                 $  99.00                      

                (13)       Family                                     $125.00                      

                (14)       Decline Coverage                         $0.00          Choice: _        Amount: $_

    An employee will be choice an optiopn 10-14 and but that number of choices. After I am about to fill with this number.

    For instnace, if an employee takes option 11, choice: 11 and amount: $ 44.00

    I put the options in a menu drop-down. The drop down menu is titled CignaMedical and Amount_1 title for amount: $_ and I made a text box.  I put this code: if (this.getField("CignaMedical").value == '10') {}
    Amount_1 = 44.00} tab calculation of properties for the Amount_1 of text box on the custom calculation script tab.

    Any help is greatly appreciate

    Yes, you can use an if-else if construction. Something like that (I got the first part because we reuse it):

    CignaMedical = this.getField("CignaMedical").value;

    If (CignaMedical == '10') {}

    44.00 = Event.Value;

    } Else if (CignaMedical == "11") {}

    Event.Value = 82.00;

    } Else if (CignaMedical == '12') {}

    99.00 = Event.Value;

    }

    etc.

  • If - then statements (k)

    Honestly, I don't know how to write any PHP, but I don't know how to create a PHP website in Dreamweaver because DW wrote all the PHP for me.

    I think that I now need to get out a bit of Dreamweaver. What I would do is:
    If the variable width = 800, so I want to show a specific hidden layer.
    If the variable height = 800, so I want to show a specific hidden layer.

    I could do that in a second in ActionScript, but I have no idea how to go about this in Dreamweaver.

    How would one write an If - then statement?

    Don't forget, all this PHP code that creates DW is like hieroglyphics to me.

    Thank you
    -Kirk

    xparrot_dude wrote:
    > I'm not having much luck. I don't know where to put the if-then you have written or if
    > the $width is a standard PHP type thing or if it is a variable.

    It is a variable. In PHP all variables begin with a dollar sign.

    > Here's what I tried:
    >
    ><>
    > If ($width == 800) {}
    {$show > visible =}
    > {else}
    $show > = hidden
    > } ?>

    You would not assign a string to a variable in ActionScript without using
    quotes. It goes the same for PHP. In ActionScript, the semicolon at the end
    a statement is optional (but recommended recommended). In PHP, there
    mandatory.


    <>
    If ($width == 800) {}
    $show = 'visible' ;}
    else {}
    $show = 'hidden ';
    } ?>

    > I then put the $show variable in my css, like this:
    > #HorizontalPhoto {}
    > position: absolute;
    > left: 53px;
    > top: 159px;
    > width: 317px;
    > height: 172px;
    > z - index: 1;
    > visibility: $show;
    > }

    The only thing that can go in CSS is CSS. If you want to use PHP, you
    must surround yourself with PHP tags and use echo or print to the output of the
    the value of the variable.

    visibility: ;

    > Please keep in mind that I've never written ANY PHP. So I don't know if I
    > need the tags or even where I can and can not put code.

    Everyone is a beginner at one point, but you will get better help if you
    make an effort to begin to learn some PHP basics yourself. A good place
    to start is with the official PHP tutorial:

    http://docs.php.net/manual/en/getting-started.php

    You will also find the PHP language useful reference, especially if
    you are already familiar with ActionScript. The two languages share many
    in common:

    http://docs.php.net/manual/en/langref.php

    --
    Adobe Community Expert David Powers
    Author, "The Essential Guide to Dreamweaver CS3" (friends of ED)
    Author, "PHP Solutions" (friends of ED)
    http://foundationphp.com/

  • Simple Insert Into statement

    I'm new to actually written SQLs to write to databases. So far, I've been pulling data with SQL queries.

    In any case, I have an existing database that I created a new column name Date_Received2
    I am wanting to insert data into this column convert a varchar2 field named Date_Received in Date_Received2.

    I thought it was a simple:
    Insert Into Table(Date_Received2) 
    VALUES (TO_DATE(TO_CHAR(DATE_RECEIVED,'MM/DD/YYYY'), 'MM/DD/YYYY'));
    Please help, I know this is probably very simple. Or if there is a better method to convert a varchar2 in a date field field - that is my main objective here.

    Thank you

    Justin, with all due respect for your contributions for a long time on the forum and the utmost respect of your Ace status, I believe that after having read the post, the OP may actually find an UPDATE here, rather than an INSERT statement.

    «I have an existing database that * I created a new column name Date_Received2 *, I'm wanting to insert data into this column * convert a varchar2 field named Date_Received * Date_Received2.»

    Everything you say about the date conversion is obviously still stands complete and clearly expressed, but I believe (and I could be wrong) that the two columns are in the same table, and then the OP wants to:

     UPDATE  set date_received2 = to_date(date_received,'YYYY-MM-DD').

    What do you think?

  • using nest if then statements using ABM

    I have a two input, 1 output circuit, as in the attached schema. My third node is set down by the very high resistance voltmeter. What I have is a user defined current source ABM that depends on other parameters in the circuit. I wonder it is what my conditional statement is entered in the right format? Conditions are particularly complex and describe as follows:

    If the voltage difference between V2 and U1 is greater than 0, then the current in the ABM = 10 ^-12

    If this voltage difference that the above is not greater than zero and if (V (1) u (1))<(V(2)-U(1)), then="" the="" abm="" current="" is="">

    Otherwise, if (V (1) u (1)) > = (V (2) u (1)) then the current is (0.1*((-(V(2)-U(1)))^0.35))*0.00001596*(((V(2)-U(1))^2)/2)

    As you can see, they are very complex conditions and my concern is that I can't just type in U1 and get the compiler to understand I want the voltage read on the voltmeter of bottom-node. I think I'm using the correct nesting in the encoding format is: if (T, X, (if(Q,R,S))).

    Any help would be appreciated, and details can be provided.

    I don't know why its not throwing an error for the use of u (1), maybe it's a valid keyword.

    If you want to reference a voltage properly, it should be V (net_name) for single ended voltages (referenced to ground) or V (net1, net2) for differential voltages... For models ABM I suggest turning on net visibility throughout the schematic so that you know the net name to the positive terminal of U1 or anywhere else for that matter.

    I think the syntax you have to if/then/else is correct otherwise.

    Kind regards
    Pat Noonan
    National Instruments

  • If then statement help

    Thanks in advance for your help. I work on a PDF form and has difficulty with a logical statement (If Then). Then the field (TotalEligibleServiceCatchup) should be the least of the three amounts: TotalElectiveSalaryDeferralMinusYearsOfServiceCatchup, LifetimeMinusCatchupAmount, or $3,000. In other words, if the Total salary deferral less years of Service catch-up is like $3,000 and life less amount of catch-up is greater than $3,000; the value of the calculated field is $ 3,000. If one or both of the first two values are less than $3,000, the calculated field is the least of these values.

    Thanks in advance for your help.

    In this case, you can use this code as the custom of your domain calculation script:

    var v1 = +this.getField("TotalElectiveSalaryDeferralMinusYearsOfServiceCatchup").valueAsString;
    var v2 = +this.getField("LifetimeMinusCatchupAmount").valueAsString;
    event.value = Math.min(3000, v1, v2);
    
  • variables php correctly loaded in flash and poster DEFY the If - then statements

    path = "http://localhost/xampp/nwjv/php/";

     

    //declare path to php files

    lvOut = new LoadVars();     //create lv object sending variables OUT to php

    lvIn = new LoadVars(); //create lv object receiving variables IN from php 

     

    lvIn.onLoad = function (success) {

    if(success)

    {

         //PHP variable value to textbox 

     

         InVal = lvIn.returnVal;

         InTxt = lvIn.retVal; 

     

         output.text = InVal;

         output1.text = InTxt; 

        

         /* 

        output1.text = "No Value"; 

         if(InTxt == 'lo' ) { output1.text = "Low Value"; } 

         if(InTxt == 'hi') { output1.text = "High Value"; }

          */

    } else { //...or notify of failure output.text = "fail"; }

     


    myBtn.onRelease = function()

      {

          //assign user-input value to lv property called years

         lvOut.years = years.text; //send to a blank window //

         lvOut.send(path + "dogyears_new1.php",lvIn,"GET");

         lvOut.sendAndLoad(path + "dogyears_new1.php",lvIn,"GET");

    };

    And simple PHP code

    PHP code:

    <?php$calculation = $_GET["years"]*2;
    if(
    $calculation <=10 ) $retVal="lo";
    if(
    $calculation > 10$retVal="hi";
    echo
    "&returnVal=$calculation &retVal=$retVal" ;?>

    PHP returns two values that are perceived by the flash in InVal and InTxt variables. The collected values are correct and are thus displayed in boxes of 2 outputs. If the value in the input box is 5 or less, the outbox1.text shows "lo" and if the entrance area is greater than 5 the output1.text shows 'hi. '

    Now, if yew commented then block in the code is activated by removing the / * / of all about him and the program is run, the If Then block fails because the comparison of the InTxt fails.  SO even if the value of InTxt is "hi" or "lo" as seen on the 1st round, but the value does not change to the 'Value' but high 'low value' according to the value of InTxt in the If Then comparison bloac.


    It has completely failed me why this is happening. While I can see the values correctly, I can't use it in conditional loops. I even tried the instructions box switch with the same frustrating result. (The output1.text is equal to 'No value' when it should change to 'High value' or 'Low value')

    Earlier I was using numbers and faulty when I tried to use strings because I thought that for some reason any PHP returns everything as strings. But as can be seen, even the string comparison fails.

    Can someone please comment on this problem and suggest a solution.

    All thanks loads!


    PS. I wanted to download the small fla for this but I could not find a way to add a file here. Please suggest if I can do and how and I'll upload my fla for this code. Thank you.

    which is caused by some problems/string number (not in your case), or a white space (probably your situation).

    to confirm that it is the white space, check the length of returned variables to see if they are more than 2.

  • Very Simple if/then issue, but can not understand.

    I have two fields of simple text, Rating and Possible.  They are formatted as numbers.  All I want to do is the following:

    If the notation = 0, then Possible will also be zero.  However, if the rating is a number any > zero, then Possible will always be 3.

    I tried more options and have had no success.

    You need not more empty space between lines of code.

    No, you should not include this comment, I added. It was just a Word to you that top line was equivalent to five lines of code that followed.

  • If then statement - hide the field 0 and counting! Help!

    OK, I try to have the Cap RATE: to do a number of things. On the side of first note, in the Privileged Postion there drop down there has 4 options, 1 fixed, 2 ch, HELOC 1st and 2nd HELOC. I'm figuring the CEILING using the APOR , if the Position of privilege claims fixed 1st or 2nd set only. So that the calculation of the ceiling RATE should read something like this, IF (States ofPrivilège Position : Fixed 1st or 2nd set then ADD (fixed 1 IF add 1.5% IF the 2nd ch ADD 3.5%) rate APOR (users will enter rate APOR).)

    EXAMPLE:

    Position of privilege: 1st set

    APOR: 3.48%

    (because it is the 1st ch)

    + 1.5%

    CAPP RATE = 4.98%

    EXAMPLE 2:

    Position of privilege: 2nd set

    APOR: 3.48%

    (because it is the 2nd ch)

    + 3.5%

    CAPP RATE = 6.98%

    Also, I want the CEILING to be TRANSPARENT or WHITE if there is no rate entered MRPS because it's to RATE FIXED ONLY.

    Capture.JPG

    Any help is greatly appreciated!

    Ok

    This can be done easily with a FormCalc script in the calculate the rate ceiling field event.

    Assuming that the other fields are named LienPostion and MRPS, the script looks like:

    if (LienPosition eq "1st Fixed") then
              APOR + 1.5
    elseif (LienPosition eq "2nd Fixed") then
              APOR + 3.5
    else
              APOR
    endif
    
  • Adding values of mulitple tables in a loop with if then statement

    So I a table set in place and need to add the hours of specific activities.

    I have Activity() as an array of drop-down boxes with things like ' holiday, regular, vacation, etc.

    Monday(), Tuesday() etc., are numeric field berries.

    and I try totals of population since the differnet activities.

    Use of Java like this and it doesn't seem to work:

    for (var i = 0; i < 12; i ++)

    {

    If (activity [i] .rawValue = 'Holiday') {}

    $. Monday = value [i] .value + Tuesday [i] .value + Wednesday [i] .value + Thursday [i] .value Friday [i] .value

    }

    }

    Am I missing something here?

    Hello

    Use FormCalc (not JavaScript). I think that you have a 'total' field for each week (i.e. total and Monday are brothers and sisters?). If so

    //////////////////////////////////////////////////////////////////////

    If ( == 'Holiday' activity) can

    $ = Sum (Monday, Tuesday, Wednesday, Thursday, Friday)

    on the other

    $ = 0

    endif

    //////////////////////////////////////////////////////////////////////

    If you are adding up for several weeks (weekly).

    If (activity == 'Holiday') then

    $ = Sum (Monday, Tuesday, Wednesday, week [*] [*] the week of the week [*] [*] the week.) Thursday, the week [*]. Friday)

    on the other

    $ = 0

    endif

    where each group of days is encapsulated in a subform named "week".

    //////////////////////////////////////////////////////////////////////

    Finally, it uses the values "boundItem" NOT the displayed value. So:

    If ( == 'Holiday' activity) can

    works only if the value of boundItem is used. Look in the BindingTab for the drop-down list to understand and configure certain boundItem values. They are strings and use "" when you reference strings. So 1 is better referenced as '1' as in

    If ( == activity '1') then

    //////////////////////////////////////////////////////////////////////

    Finally, if needed of statements == (do not use a single =).

    I hope this helps!

    Stephen

  • Maybe you are looking for

    • Thunderbird gets "(ne répond pas)" "

      Hello I'm having this problem of "Thunderbird no longer" for some time. Lately increased in frequency. Tried to reinstall and several other methods mentioned in these forums. Nothing seems to solve my problem. After all these years, I don't want. Can

    • How to cancel my subscription to music?

      Hello I am trying to cancel my subscription to music. I started the trial with the purchase of my iPod and do not want to renew it. I can't find anything on my account settings to cancel it. Thank you Bob

    • Satellite R630 - 11L refuses to turn on the backlight

      I'm busy, having a glance at someone R630 - 11L who refuses to turn on the backlight. I am suspecting the lid sensor does not work correctly because the device also refuses to go to sleep if you close the lid. The only problem I have with this theory

    • How can I put 'Shopping' back on the toolbars of safari please?

      We would like to know how to put the 'Shopping' button at the time where we open safari? thanx

    • Whenever I start my vista classic replaces the task bar.

      When I restart my vista pc the taskbar and change to windows Classic aero window theme. I can still change to aero, but it always changes to the classic. I still have a lot of space in my memory. Why is this happening? Help.