Calculation in an add instance

I am trying to use an if statement in an addinstance of an interactive form.  Based on the results of one field in the addinstance, I want to sum a different field from the add instance.  So, the customer can add any number of rows and choose from a drop down (coded 1-4) the position of the person.  If that position is 1 or 2, I want to sum the salary field in a calculation box.  If the position is 3, then I want to sum the salary(ies) in a second calcuation box, and if the position is 4, then I want to sum the salaries in a third calculation field.  My code for one of the the calculation field looks like this:
form1.#subform[8].#subform[9].details.total.conditions.#subform[0].numTotal[
1]::calculate - (FormCalc, client)
if (detail[*].PTFT < 3) then
      Sum(detail[*].salary)
      endif
The other two fields are the same except that they change "<3" to "==3" or "==4". 
The problem is that it does not sum the second or third calcuation field.  Only my first calcuation field will work. 
Since it is a rather simple if statement, I think that the problem may be in the subforms, possibly?
Please see my form at http://www.units.muohio.edu/lifelonglearning/forms/zzztest.pdf
Thanks in advance for any help you can lend.

Ok I had a look at your form (nice form by the way ...good job). The expression you are using to determine the number of instances is not correct....as well when you sum the salaries it is the details subform that has th eiccurance numbers so that needs the * notation. Here is the 1st calc modified
if  (details._detail.count < 3) then
     Sum(detail[*
].salary) 
endif
You also have the same code on the layout ready and the calc event. No need for both ...just leave it on the calc event and when the user enters the amounts the totals will update.
You are also getting an error when the row initialize .....a partNoScript is being called becuase of script behind the Name field (itis called txtPartNo in your form). My guess is that you copied this from the Purchase Order sample and forgot to remove the scritp from the Initialize and the change event. This field was originally a DD field and that is what was used to populate it.
Hope that helps
Paul

Similar Messages

  • Adding add instance into calculation

    I am trying to get  fields  from  add instance/subform fields to calculate with the rest of the form fields. The problem I am having is once I "add instance" the field is no longer part of the calculation. I have tried using:// Verify at least one instance of the midtr3a field exists.
    if 
    (exists(location.yes900.admids.midtr3a) == 1) then
    Sum(location.yes900.admids[
    *].midtr3a)
    endif
    would appreciate any help on this.
    Thanks K

    I think you do not have to check for whether the field exists or not..Because when you use the "Sum" function, it will check if the field is present and if it has value or not.
    You may directly try the following int he script..
    Sum(location.yes900.admids[*].midtr3a
    Also in your Exists function, you are checking "exists(location.yes900.admids.midtr3a)".. This will only check for the first instance of the field.
    Thanks
    Srini

  • Add instance on Read only field issue

    I have a subform with two fields , one a date field to capture current system date and time and another is a Text field for some comments.
    Then there are two buttons ,one for Adding the instance for these two fields and another is a Save button which makes these two fields
    The requirement is that once both the fields are filled with data and i click on save button, the fields should become read only ,however when i click on the add instance button the instance is added successfully but the save button click is not making the new instance read only.
    The Code for Add Instance Button is :
    "New1.FileNote.instanceManager.addInstance(true);
    xfa.form.recalculate(true);"
    The code for Save button to make the fields read only is :
    New1.FileNote.DateTimeField101.access = "readOnly";
    New1.FileNote.TextField37.access = "readOnly";
    Please guide me as I am totally blank on how to code the same..Have a rough logic of using a for loop with index of the Add Instance but not getting the way out for the code.
    Thanks a lot for any help and guidance.

    Hi Steve,
    Thanks for your reply..I made it happen using the for loop with Index and resolve node. However there is another issue which occured after that..I have a date/time field in that repeating subform instance.
    The run time property is set to Current Date/Time. Now the issue is whenever i click on save, form.recalculate instance changes the existing time value in the previous subbform instance as well
    Is there a way to retain the existing value in the field of the previous instance ??
    Regards
    Kapil

  • Add instance in a subform which also can be doubled

    Hi,
    I have a subform X which can be doubled by a click on the button. In that subform X there is another subform Y which also can be multiplied to a maximum of 3.
    Now when I add a subform X and i want to add some subforms Y. The form will only add the subform Y in the first subform X and not in the second one.
    This is the script I use:
    for subform x
    if(Incitant52.subFoireAcheteur.all.length < 2){;
    Incitant52.subFoireAcheteur.instanceManager.addInstance(true);
    and for subform y
    if(Incitant52.subFoireAcheteur.subAcheteur.all.length < 3){;
    Incitant52.subFoireAcheteur.subAcheteur.instanceManager.addInstance(true);

    To add instances to the second occurance of subform x you will need to address it with subformx[1].
    Note that the [ ] brackets are not valid in javascript so your expression should look something like this:
    xfa.resolveNode("Incitant52.subFoireAcheteur.subformx[1]").instanceManager.addInstance(1)

  • Add Instance Subform content to textbox

    Hi all,
    There is sth I would like to do.
    I have a form which has a text field that is in a subform where you can add instances. No problem with pages etc.
    Now, I have created a text field where I would like all entries to be repeated as plain text possibly separated by rows.
    For example:
    Textbox in Subform: Eggs
    Textbox 2 in Subform (after clicking the add instance button): Butter
    Text box at the end should either say:
    Eggs, Butter
    or
    Eggs
    Butter
    Does anyone have an idea on how I can achieve this?
    Thanks a lot,
    Larissa

    Hi Paul,
    Actually I have several requirements. I have attached the pdf as this seems easier at this point.
    At the beginning of the pdf, I have the marks in three boxes. I would like to concatenate them with a comma between the different entries into a text field that users can then copy paste into the next form.
    Let’s say in the first box you put:
    A
    B
    C
    In the second,
    D
    E
    I would like to have a text box that comes out as: A,B,C,D,E
    Second problem I am facing with this task is at the countries.
    I have a country online selection and a second country selection.
    Ideally I would like to have just one box with all countries and be able to tell the pdf that certain countries have the characteristic “Online”.
    Thus if the client clicks on “Add” I would have two list boxes: One for Online and one for Rest. Depending on what the characteristic of the country it would either go into the Online or the Other.
    Any ideas on my problematic.
    I was thinking working with numbers and maybe telling the system that if it is under 100, move to Box 1, if it is over 100, move to Box 2.
    Thanks for your help.
    Kind regards,
    Larissa

  • Need help with add instance

    I'm can't figure out how to add a new record with add instance, see below for basic code.  The second one works but I can't re-create it.  I'm guessing something basic that I am over looking.
    I also can't figure out how to attached my pdf's so you have to download from my website.
    Thanks,
    Jay
    http://www.atg.state.vt.us/assets/files/Adding%20a%20row%20-%20does%20not%20work.pdf (does not work - need help)
    http://www.atg.state.vt.us/assets/files/Adding%20a%20row%20-%20works.pdf (this one works - I didn't create it)

    It looks as if you have saved the form as an Acrobat 7 STATIC form....you
    need to save it as a DYNAMIC form.  You will find that option in the file
    types in the save as dialogue.  I resaved it locally and your form works.
    Hope this helps

  • Can't Add instance code

    I am working on a flash file AS2 that contains some combo
    boxes.
    When I start the program I can right click on a button and
    add instance code ie current selection is the button.
    After working on the file for a while I can't do this.
    When I right click on new buttons and objects and select
    actions the current selection shows as the frame not the
    object I want to add code too.
    This is very frustrating as I basically can't add instance
    code.
    Any help would be greatly appreciated
    Alfred

    I think the problem was the pin current script button. Some
    how I clicked this and no matter what I right clicked on it would
    always take be to the last script I used before I hit the button.
    Thanks for your prompt response.
    Alfred

  • Ciscoworks 4.0, netconfig job, add instance problem

    I'm trying to make an adhoc job to some devices in ciscoworks.  I select netconfig jobs, select the devices I want to do a change to, and then select add instance, I get a new browser window saying loading and nothing more happens.
    I cannot create the config lines I want to perform to my switches.  I just want to change the vtp domain name to the switches, but cannot do this due to the blank browser window saying loading.
    Anyone know anything about this?
    Br
    Geir

    I just updated my LMS 4.0 device packages, and I cannot reproduce.  I then noticed your SharedNetconfigIOS.zip package is larger than mine.  I suspect it's corrupt.  Go to Admin > System > Software Center > Device Update, check the boxes next to Common Services and Inventory Config And Image Management and download and install all available packages.  If none are available, you will need to contact TAC to get an up-to-date package repository to correct this problem.  You can click the "Open Service Request" link in the Actions panel of this thread to capture everything we've done here if you have to open a service request.

  • Add Instance

    In the first image below the user can click on "AC" to add additional lines for comments. When they have completed that they will click on "Add Line" to add a new instance of that line. In the 2nd image the 2nd line is overwritting the additional comments add to the 1st line. How do I position line two and additional lines to occur at the bottom of the additional comments (1 comment or 5+)
    Also I need two more buttons
         1. Will add line and copy the contents of the line above
    `    2. Move line - Up and Down button that will allow the user to reorder the entries.
    Thanks in advance for your help!

    Hi,
    The example has several tables, the last two have add, remove buttons, as well as move button and button to add rows directly underneath (add instance and move it in one click).
    There is an example I did here for someone. https://acrobat.com/#d=HD6XJ1qofZDf713Yq1P43g. From memory the add instance script also copied the rawValue of the "Send to" object to the "Reviewer" object in the new instance. This should give you a direction.
    When it comes to LiveCycle Designer there is no single source with all of the information. Some of the Adobe resources are extremely valuable, but do not make for light reading.
    A good book to start out with is JP Terry's book on LC Designer, which is excellent - "Creating Dynamic Forms with Adobe LiveCycle Designer".
    We have some solutions and blog posts on our website http://www.assuredynamics.com. We are trying to make some of examples more instructional. Also if you go to the blog on our site you will see some other blogs that we strongly recommend.
    There is also a range of online resources. You may find these resources helpful:
    http://www.adobe.com/go/learn_lc_scriptingBasics
    http://www.adobe.com/go/learn_lc_scriptingReference
    http://www.adobe.com/go/learn_lc_formCalc
    http://www.adobe.com/devnet/livecycle/articles/Adobe_XML_Form_Object_Model_Reference.pdf
    http://www.adobe.com/devnet/acrobat/pdfs/lc_migrating_acrobat_xmlform. pdf
    And a very handy resource (and while it is for version 6 it is still very good because of the way it is laid out):http://partners.adobe.com/public/developer/en/tips/CalcScripts.pdf
    The help file also helps with syntax and LC Designer comes with templates/examples.
    Lastly, check out the Developer's Network on http://www.adobe.com/devnet/livecycle/
    Also a book that doesn't deal with scripting at all but is very good on form layout is "Forms that Work" by Caroline Jarrett and Gerry Gaffney.
    The Adobe "PDF Forms Bible" is okay, but mainly focuses on AcroForms.
    Windjack Solutions have a subscription based service for solutions and scripts at http://www.pdfscripting.com. It has a lot of AcroForm script that can be amended to suit LC Designer and a growing library of LC Designer solutions.
    Hope that helps,
    Niall

  • Add Instance variable

    1.
    Can we add instance variables to an existing standard agent
    e.g. can we edit the metadata file for an UNIX host (default agent installation which OEM provides) and add owr own variable ?
    2.
    How do we edit and add the values under "Target Properties" for each agent. Couldn't find a Save button...The following properties look empty and just wondering how do we add them ?
    Comment
    Line of Business
    Deployment Type
    Location
    Contact
    Thank you

    I dont understant what you say 'instance variables'
    Provide me what are your problem or what do you need
    Regards
    PD: The target properties of a host or database can edit with grid control console or if you edit the targets.xml file
    the agent properties also can edit if you modify the emd.properties

  • Calculations do not add up, how to fix in Adobe Acrobat XI Pro

    I'm working on a budget sheet where I would like to have all expenses add up under the "Surplus/Shortage" However when I input the expenses on the expense columns the total "Surplus/Shortage" is one digit off.  Anyone know why that might be?  For the "Surplus/Shortage" field I used the simplified filed notation subtracting the income from expenses.  The "expenses" and "income" field above have their own calculations which I used the "Value is the Sum . . ." method.  Help!

    The Acrobat JavaScript Console (Your best friend for developing Acrobat JavaScript)
    How are you performing your calculations?
    Can you provide a link to the form so we can see how the calculations are being done?

  • My calculation "Total" box adds sum of all text fields whether they are visible or not, do I change

    I have check boxes that show and hide text fields. (Thanks to Gilads Java script). In options I have a default value for each text field.
    My "Total" Field field adds all fields even if they are not checked and visible. Need to have it only include them if they are checked and visible.

    You can't attach forms by email, or any other means, so it didn't come through.
    Since your fields have default values and aren't calculated based on the state of the corresponding check box, you will have to use a custom calculation script for the Total field that can check to see if any of the fields are hidden, and if so, don't include their values in the sum. For example:
    // Custom calculation script
    (function () {
        // Set up an array of field names to include in the total
        var aFields = ["text1", "text2", "text3", text4"];
        // Initialize variables
        var i, f, sum = 0;
        // Loop through the fields an calculate the sum
        for (i = 0; i < aFields.length; i += 1) {
            // Get the current field
            f = getField(aFields[i]);
            // Add the value of the current field to the sum if the field is visible
            if (f.display == display.visible) {
                sum += +f.value;
        // Set this field value to the sum
        event.value = sum;
    You can send me a PM if you want help offline.

  • For Statement on a table using add.instances - need help

    Hi,
    I made this table in an acrobat form.   The table uses java script to add rows .   The code I used is:
    _detail.addInstance(1);
    There are two fields on this table that I want to evaluate 1)  an index named index1    
    and 2) the value named numAmount
    The script I am using to evaluate these to fields is as follows:
    if (form1.Page1.Subform1.Capital1.Capital1.detail.index1.rawValue ==2)
        then
        $.rawValue = form1.Page1.Subform1.Capital1.Capital1.detail.index1.numAmount.rawValue 
        endif
    My problem is that I need to nest this if statement inside some kind of a loop.    I want the program to look at my table, determine how many instances the user has added,  scroll through the table and look at index1,  if index 1 = 2 then i want it to return the value in numAmount.
    I just can't get the syntax to work in either form calc or javascript.
    I am trying to write this code using the calculate method on a fourth field located on form1.#subform[2].Table5.Row5.NumericField1
    I have attached the file if it helps.   The table is on page one of the form and the display field is on page three. 
    Any help would be much appreciated!!!

    This is an Acrobat Forms JavaScripting forum, you might find more help in one of the LiveCycle Designer forums.

  • Calculator doesn't add correctly in 10.4

    I noticed today that the calculator can't cope with large numbers. Can someone confirm this:
    Add 1234567891 + 1. The answer should be 1234567892. But the calculator comes up with 123470000.
    I know that it is known that in RPN mode, if you add 104.64 enter 145 + you get a rounding error, with the answer given as 250, and not the correct 249.64.
    Why doesn't either of these issues come up when you do a search in support?

    Bill Jelavich wrote:
    Add 1234567891 + 1. The answer should be 1234567892. But the calculator comes up with 123470000.
    I cannot reproduce this. Like everyone else, I get the correct answer.
    I know that it is known that in RPN mode, if you add 104.64 enter 145 + you get a rounding error, with the answer given as 250, and not the correct 249.64.
    I CAN reproduce this, but only if I have the number of decimal places set to zero. In this case 250 is the correct answer. Incidentally, RPN mode has nothing to do with it: you get 250 in normal mode too.
    Why doesn't either of these issues come up when you do a search in support?
    Ah, now that's altogether a different question Search is broken, very badly so. You are lucky to find anything using Search.

  • Subforms within subforms add Instance problem

    Hi
    I am new to Adobe Livecycle Designer (I am using version 8.2.1) but I have successful made nearly all elements of the quite long form I need to produce except for one section I am having difficulty getting it to function correctly. In the example I have a repeating subform ‘Organisation’ on page subform ‘Membership’ which has buttons to add and remove instances, which work correctly. But within each instance of this ‘Organisation’ subform is another repeating instance subform ‘ExpertNames’ with buttons to add and remove instances.
    The ‘Organisation’ form allows an organisation to be named and the ‘ExpertNames’ subform allows multiple members for that organisation to be named and associated to each organisation. The user should be able to list multiple organisations each with one or more members. I can successfully add multiple instances of ‘Organisation’ form one after another using
    Membership.Organisation.instanceManager.addInstance(1)
    and remove the selected instance using
    Membership.Organisation.instanceManager.removeInstance(this.parent.index)
    I have the following set on the button to add a new instance of the ‘ExpertNames’ form
    Membership.Organisation.ExpertNames.instanceManager.addInstance(1);
    and the following to remove the selected instance of the 'ExpertNames' form
    Membership.Organisation.ExpertNames.instanceManager.removeInstance(this.parent.index);
    However when I add a second instance of the ‘Organisation’ form i.e. a new organisation and try and add additional members to the 2nd organisation it adds them to the 1st organisation rather than the second! I have an example of the problem form i can send if needed.
    Hope someone will be able to help with this.
    Many thanks in advance
    Lara

    I still have not been able to find a solution to this does anyone have any ideas?
    I have an example of the problem in a form that I can email.
    Many thanks in advance
    Lara

Maybe you are looking for

  • 10.5.3 Seems to have solved Photoshop CS3/Spaces problem

    I've just backed up and installed the 10.5.3 update. The only remaining problem with PS CS3 and Leopard was using Spaces and finding out that the Palettes, Tool Bar and Options Bar would frequently not redraw, depending on how you used Spaces. Twenty

  • IPhoto: slideshow music selection shows OLD iTunes library.

    Hi, I have re-organized my iTunes library a while ago (new playlists, different location of the files, everything in AAC, etc., but now I can't see my music anymore in iPhoto. All I see is the old iTunes library and I can't figure out how to 're-sync

  • Truetype fonts displaying blank in CS 5 apps

    Howdy, We have some fonts of ours which show up in the font menu, but when you change to that font, it displays nothing. Say you type a sentence, then select it and then change the font its using. Blank!!!!, looks like it dissappears. But if you move

  • Importing .avi (.xvid) audio only, basically no video

    [post deleted by forum host] Please read the forum rules and terms of use again.

  • CS5 crashes on startup

    I know this has been covered a lot here so I'm sorry if this is a repeat. But we have found and tried all the below suggestions I was able to locate. (all the creative suite programs CS5 suddenly started crashing on startup) We have. 1- temp removed