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="" :="">

Tags: Acrobat

Similar Questions

  • Flash beginner needs help with Movie Clips/Action script

    HI -.

    I'm having a problem with my video clips playing simultaneously and cannot, for the life of me, know what I did wrong. I'm new to flash so I can I have created something wrong but this is what I have so far:

    11 layers, total: 1 layer with 10 buttons, each button with the following actionscript code:


    on (release) {}
    gotoAndPlay (85);
    }


    When the number changes with regard to keyframes, the next film is about.

    I have 10 films, total, but they are only video clips, mainly photo slideshow with audio, does everything in the library.

    The problem occurs when I click on the second or third button. Not only the movie I selected starts to play, but all previous clips are as well, he has completely blurred all the sounds. I don't know what Miss me in action script, as my Action layer has a stop command to this topic at each keyframe where there is a new clip to play.

    I tried to add a stopAllSounds command, but I'm afraid that does nothing because it is not an "audio file" in itself playing in the timeline panel.

    I'm at the end of my rope and really need help to understand this one. My project is hanging in the balance on this point, I wrote everything correctly and it works beautifully.

    Help, please!

    Thank you
    Caroline

    Start your sounds in frame 2 and place stopAllSounds() on each keyframe where begins a movieclip.

  • Need help with simple flash keys

    So I need help either direct tutorial or someone to point me in the direction of something useful.

    What I'm trying to do, is create 3 clickable flash buttons which all have a link to a small box. I want these buttons to make the text appear in the box when clicked. I want the box to be a Virgin until a button is clicked.

    EXAMPLE OF

    _______________
    | TEXT HERE |
    |                          |
    |_______________|
    ___     ___     ___
    |__|     |__|     |___|

    Thank you very much in advance.

    Strike what I said about the code being fine.  It is not (my eyes just woke up).  This is a correct coding for the way you had it.  To have the button share the same function of handler you need another approach that tests for which the button is clicked.  Instead of this approach, below I show each button has its own manager function...

    Stop();
    BTN1.addEventListener (MouseEvent.Click, mouseClick1);
    function mouseClick1(event:MouseEvent):void
    {
    gotoAndStop (2);
    }

    Btn2.addEventListener (MouseEvent.Click, mouseClick2);

    function mouseClick2(event:MouseEvent):void
    {
    gotoAndStop (3);
    }

    BTN3.addEventListener (MouseEvent.Click, mouseClick3);

    function mouseClick3(event:MouseEvent):void
    {
    gotoAndStop (4);
    }

  • Need help with a basic host script?

    All I recently started using Powershell scripts and as big a language it is that I'm still learning at the 'very' early stages. All I would do is create a script that reads some hosts from a text file, and then it receives some info on all the virtual machines associated with this host. I know that the get - vm command can do for ALL the virtual machines in VC but when I run my script it seems to get the information for the VC together and NOT on a per-host basis. (We have several hosts within the domain and require info VM only a couple). Ive checked some samples but nothing that allows me to get the info I need Heres my script so far (very basic, I know!)  $hostlist = (get-vmhost-name (get-content c:\hosts.txt) | select name) #Get VMs for each host foreach ($esx in $hostlist) {$VMs = get - vm foreach ($vm in $VMs) {Write-host $vm. Write-host $vm name. $vm.numcpu MemoryMB Write-host Write-host $vm. Guest}} I know its really basic so far, but all I'm trying to achieve is just get some info on some VMS and report to the console (I know that I can send the information to a spreadsheet myself so now worries it) thank you very much for you help in advance

    You can limit the virtual machines, you receive chaining cmdlets Get-VmHost and Get - Vm together like this

    $hostlist = (get-vmhost -Name (get-content c:\hosts.txt) | select Name)
    
    #Get VMs for each host
    foreach ($esx in $hostlist) {
      $VMs = Get-VMHost $esx | Get-VM
      foreach ($vm in $VMs) {
        Write-host $vm.Name
        Write-host $vm.MemoryMB
        Write-host $vm.numcpu
        Write-host $vm.Guest
      }
    }
    
  • need help with first vsphere powercli script

    Greetings,

    Asked me to write a script to iterate over all the virtual machines in a given folder and to stop.  The name of the folder is blue (and is deep in several files).

    So far, I have:

    $svr = Connect-VIServer-Server svr-protocol https-user--password...

    $fldr = get-file-server $svr - blue name

    I don't know what to do next.  I would like to somehow get a picture of the VMS in the Blue folder, and then run:

    {foreach ($vm to $vmlist)

    Get - VM $vm | Stop-VMGuest

    }

    How can I do this?  Ideally, it should be wrapped in a function that I could pass the name of the file, because I really need to stop the virtual machines in the blue folder and a few others, too.

    Any help would be greatly appreciated.

    Thank you

    -John

    You can specify the file on the location of the Get-VM cmdlet parameter.

    Something like that

    foreach( $vm in (Get-Vm -Location (Get-Folder Blue)) {
        $vm | Shutdown-VMGuest
    }
    

    In PowerShell and PowerCLI, there is of course more then a way to get there.

    It should work as well

    Get-Folder Blue | Get-VM | %{
       Shutdown-VMGuest -VM $_
    }
    

    ____________

    Blog: LucD notes

    Twitter: lucd22

  • 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.

  • Need help with simple non-registered form if is displayed.

    Hello

    I'm assembling a script complex but I will start with the first statement logice.

    Essentially at the beginning, I need to know how to write a script that uses the logic if the form is NOT saved, then display message, you need to first save the form.

    It is for this part! Thank you.

    Hello

    You can do this way.

    Acrobat/Reader uses the so-called State dirty indicator if you made changes to the form.

    var dFlag = event.target.dirty

    If (dFlag is true)

    {

    xfa.host.messageBox ("form not was not yet registered");

    }

    on the other
    {
    code to run the case...
    }
  • Desperately need help with simple program crashing using Qt and stdlibc ++

    I have a really trivial example that I was unable to get it running no matter what I try. I use ndk2.0.1. The configuration to recreate the problem is simple; the project should link to qt (4.8.2) and stdlibc ++ (not libcpp, libstdc ++).

    (main.cpp)

    #include 
    #include 
    int main(int argc, char *argv[])
    {
        std::cout << "This doesn't work\n";
        return 0;
    }
    

    That's all. You can use any toolchain you want (ntoxg ++ or CQS), seems not to matter. If you use the string of tools qcc, you must explicitly include the paths libstdc ++ and link to him, because it uses default libcpp. Build the project: it should compile correctly. The handle bar I used is here (http://pastie.org/4018541).

    Create the folder bar and deploy. Once I have started the program at this point, it show me the splashscreen for a few seconds and quit (crash)... You will notice:

    * No log output (we expect something of the call cost)

    * a nice base file pending crash

    Browsing the ntox-gdb core file gives you:

    #0  0xb8b5e329 in __gnu_cxx::__exchange_and_add (__mem=0x0, __val=-1)
        at atomicity.cc:36
    36  atomicity.cc: No such file or directory.
        in atomicity.cc
    
    (gdb) backtrace
    
    #0  0xb8b5e329 in __gnu_cxx::__exchange_and_add (__mem=0x0, __val=-1)
        at atomicity.cc:36
    
    #1  0xb8b03471 in __exchange_and_add_dispatch (__val=,
        __mem=)
        at /home/builder/hudson/650-gcc-4.4/svn/linux-x86-o-ntox86/i486-pc-nto-qnx6.5.0/pic/libstdc++-v3/include/ext/atomicity.h:79
    
    #2  _M_remove_reference (this=)
        at /home/builder/hudson/650-gcc-4.4/svn/linux-x86-o-ntox86/i486-pc-nto-qnx6.5.0/pic/libstdc++-v3/include/bits/locale_classes.h:505
    
    #3  std::locale::~locale (this=0xb837d5fc, __in_chrg=)
        at ../../../../../libstdc++-v3/src/locale.cc:89
    
    #4  0xb8b0faa9 in ~basic_streambuf (this=,
        __in_chrg=)
        at /home/builder/hudson/650-gcc-4.4/svn/linux-x86-o-ntox86/i486-pc-nto-qnx6.5.0/pic/libstdc++-v3/include/streambuf:193
    
    #5  std::basic_filebuf >::~basic_filebuf (
        this=0xb837d5e0, __in_chrg=)
        at /home/builder/hudson/650-gcc-4.4/svn/linux-x86-o-ntox86/i486-pc-nto-qnx6.5.0/pic/libstdc++-v3/include/fstream:215
    
    #6  0xb0bbd205 in __cxa_finalize ()
       from /home/preet/bbndk-2.0.1/target/qnx6/x86/lib/libc.so.3
    
    #7  0xb832de67 in _btext ()
       from /home/preet/bbndk-2.0.1/target/qnx6/x86/lib/libcpp.so.4
    
    #8  0xb836a265 in _fini ()
       from /home/preet/bbndk-2.0.1/target/qnx6/x86/lib/libcpp.so.4
    
    #9  0xb0bd46d3 in ?? ()
       from /home/preet/bbndk-2.0.1/target/qnx6/x86/lib/libc.so.3
    
    #10 0xb0bd5d38 in ?? ()
       from /home/preet/bbndk-2.0.1/target/qnx6/x86/lib/libc.so.3
    
    #11 0xb0bbd052 in _cleanup ()
       from /home/preet/bbndk-2.0.1/target/qnx6/x86/lib/libc.so.3
    
    #12 0xb0bbd337 in exit ()
       from /home/preet/bbndk-2.0.1/target/qnx6/x86/lib/libc.so.3
    
    #13 0x080487b0 in _start ()
    

    I have no idea what to do with this stack trace and I was not able to debug the problem more far.

    This question is particularly messed because I did not add any code to Qt on demand; just link to bookstores. Do not link to the Qt libraries will make this piece of code will work perfectly. A link to the Qt code with libcpp instead of libstdc ++ will also code to run as expected.

    This problem has been driving me crazy for the last days coueple and I would really really appreciate help or advice.

    KDAB guys told me it's a bug and they're looking into it.

  • Need help with this find/replace Script.

    Hi I got this script from Loic.Aigon.  And I got it works for find/replace simple changes however I Cannon operate for several changes.

     function cb5CallBack(target) {
            var findProps, changeProps;
            
                findProps = {findWhat:"Distributed by ",}   
                  changeProps = { changeTo:"Distributed by. ",}
                findProps = {findWhat:"Distribué par ",}   
                  changeProps = { changeTo:"Distribué par. ",}
                findProps = {findWhat:"Distribuido por ",}    
                  changeProps = { changeTo:"Distribuido por. ",},
              
            RTXT(target, findProps, changeProps);   
            } 
    

    function RTXT(target, findProps, changeProps)
    {
    app.findChangeTextOptions.caseSensitive = true;
    app.findTextPreferences = app.changeTextPreferences = NothingEnum.nothing;
    app.findTextPreferences.properties = findProps;
    app.changeTextPreferences.properties = changeProps;
    app.changeTextPreferences.properties = changeProps;
    target.changeText();
    }
    

    You must call the function RTXT repeatedly as well:

        var findProps, changeProps;

        findProps   = { findWhat:"Distributed by "};

        changeProps = { changeTo:"Distributed by. "};

        RTXT(target, findProps, changeProps);

        findProps   = { findWhat:"Distribué par "};

        changeProps = { changeTo:"Distribué par. "};

        RTXT(target, findProps, changeProps);

        findProps   = { findWhat:"Distribuido por "};

        changeProps = { changeTo:"Distribuido por. "};

        RTXT(target, findProps, changeProps);

  • Need help with simple database creation in number.

    I'm trying to create a simple database in number to capture the case IDs on my place of work. After you have entered a value in the worksheet 1 details must automatically added to sheet 2. Once the case details are entered and user click on the "submit" button (could not include in the screenshot), it should appear in the sheet 2. If number offers this feature, it would be very useful for me.

    Thanks to ddvance,

    Nanan

    Why don't you just enter values directly in the second table?  You could format C and D in the context Menu.

    SG

  • Need help with simple string formatting

    Hello

    I have an a number expressed as a string, but can be changed.

    Basically, this is my dilemma: I have a number (for example: 4051) and I need to look like: 40,51

    How can I write a formatter to transform my number in this format? The number is read from an XML file and is dynamic.

    Thank you (I started to write Flex a few days previously, that it is the first time that I was hooked even remotely)
    -Adam

    http://livedocs.Adobe.com/flex/201/langref/MX/formatters/NumberFormatter.html

    Tracy

  • [Error number: 0x8024400A] Need help with this error... I reinstalled XP SP1 and I can't get an auto update that's simple to install, just get this error every time

    [Error number: 0x8024400A] Need help with this error... I reinstalled XP SP1 and I can't get an automatic update that's simple to install, just get this error at each time HHHHEEEELLLPPPPP! Thank you

    I had the same problem.  But finally found a solution.  If your listing is similar to mine, then keep.  XP Media Center Edition 2005 (sp2).  AMD Athlon 64 x 2 Dual-Core, HP a1630n desktop computer.

    Go to the HP website, search for sp37394-XP sp3 Upgrade utility Microsoft for systems equipped with AMD processors.

    I had the same 0 x 80240036, 0x8024400a error, but realize my problem was really get manually downloaded sp3 and installed without continue loop crashing and not error messages.

  • Need help with a script (o - o8) *, see the Virgin if there is no

    Hi all what I need help with a script I can't find an example.

    I'm trying to subtract 2 numbers and then multiply this product. (o o8) * one but I just want to do the calculations if all fields have the numbers IE field o, o8 of field and field one.

    Thank you in advance. I was stuck on this days searching the Internet.

    Assuming you want to affect the outcome of this calculation in another text field, use this code as a custom field calculation script:

    var o = this.getField("o").valueAsString;
    var o8 = this.getField("o8").valueAsString;
    var a = this.getField("a").valueAsString;
    if (o!="" && o8!="" && a!="") event.value = (Number(o)-Number(o8))*Number(a);
    else event.value = "";
    
  • Need help with custom script to rename the layers

    Hello world.

    I need help to write a custom script (because I suck at it) that will allow me to go through all the layers and sous-calques for a specific name ('X') and give it a new specific name ('Y').

    I have had success using the script below, but it does not work on any text layers names where the text layer was previously particularly well-known in 'X' and now changed needs.

    Any help is greatly appreciated.

    * Note: this script was originally used to find any layer with 'Copy' in its name and remove with anything after (to correct the problem of duplication of layers by adding this text).

    This is why the function is named removeCopy. It works for renaming layers also - just not a layer of text unfortunately.

    #target illustrator

    function removeCopy() {}
    If (app.documents.length == 0) return;
    var app.activeDocument = docRef;
    recurseLayers (docRef.layers);
    }
    removeCopy();
    function recurseLayers (objArray) {}
    for (var i = 0; i < objArray.length; i ++) {}
    ObjArr [i] .name = ObjArr [i].name.replace (/ \s*current name\s*\d*/, 'new name');
    If (objArray [i] .layers) recurseLayers (. layers.length > 0 ObjArr [i]);
    }
    }

    I finally found something after searching forums for a week. My confusion was related to the way Illustrator treats real layers against text/path/object "layers." Instead of layers, I had to use the pageItems in the script. The code below works. Thanks to Gustavo for his answer in another thread and Carlos I thank you for this looking too good! You're great to be ready to help models do more advanced things with Illustrator.

    var doc = app.activeDocument;
    var items = doc.pageItems;
    for (var g = 0; g)
        elements [g] .name = elements [g].name.replace ('Century Schoolbook text line', ' MonogramText: Century Schoolbook ");
    };
    App.Redraw ();
  • I'm on Acrobat 10 and I need help with the distribution of shape feature. Is there a way to change the registration e-mail download addressed to the? Currently all forms I create and then distribute may only be subjected to my email account... I appreciat

    I'm on Acrobat 10 for mac and I need help with the distribution of shape feature. Is there a way to change the registration e-mail download addressed to the? Currently all forms I create and then distribute may only be subjected to my email account... I appreciate any help!

    Do not use the feature distribute the form. Instead of this, just put up a button "submit" and configure it to send email using any email address you want. Just add a button and set the action of the mouse upward on "Submit a form" and use a type mailto URL and specify that you want to send the full PDF. Then activate the reader of the document: where "Advanced/extended features in Adobe Reader" is located in Acrobat XI?

    If you really want to use distribute the form for some reason, change the e-mail address in your preferences: Edit > Preferences > identity > Email address

Maybe you are looking for