Referencing subform instances

I have a tricky issue now that I am hoping someone can help with. I have an 8 page XFA form where the first 4 pages cannot be made expandable because the recipient company has to scan them when sent in by customers - so layout has to stay fixed. On page 2 there are three tables with fixed number of rows where the user can declare their shares in different currencies. If they have more shares than the rows allow, or more currencies, they can go to page 6 where they can add other currencies or more of the same currency from page 2. Each currency subform on page 6 is dynamic, and can have as many rows as needed.
At the bottom of page 2 is where the totals of each currency for the whole form have to be declared individually - so £ from page 2 and page 6 (continuation), $ from page 2 and 6, and so on - reported as "£xx + $xx + Rxx".
I have the form dropping each page 6 subform totals of each currency into separate boxes (eventually to be hidden) so that they can contribute to page 2 totals.
The problem I have is that only the first instance from the page 6 currency contributing to the section 6 total - whichever currency is declared first. The others do not contribute.
The script (FormCalc)calling that is:
var do1 = Sum(topmostSubform.Page2.p2content.total_aggregate_nominal_dollar.rawValue) //page 2 value
var do2 = Sum(topmostSubform.Page2.p2content.total_aggregate_nominal_dollar2.rawValue) //alternative page 2 value
var do3 = topmostSubform.Page6.currency.Row2[*].calcs.total_aggregate_cont_dollar.rawValue //page 6 value
if (do1 >= 1)
then 
$ = do1 + do3
elseif (do2 >= 1)
then 
$ = do2 + do3
endif
What do I have wrong? Would I be better off in Javascript? 

You must add the function Sum() to have each value together
var do3 = Sum(topmostSubform.Page6.currency.Row2[*].calcs.total_aggregate_cont_dollar.rawValue) //page 6 value
as long as this is formcalc and not javascript

Similar Messages

  • Remove subform instance problem

    HI there
    I am using the following code to remove the last subform instance
    subform.instanceManager.removeInstance(1)
    However in test it appears to be removing the last instance but one.
    Can anyone help me fix this.
    Thanks
    Darren

    Hi Paul
    Many thanks for your quick response.  When I added that to my form it removed the first instance rather than the last instance.  I had a look on the links here and for any one else that has a similar prob the following seems to have fixed the problem
    subform.instanceManager.removeInstance(subform.instanceManager.count-1)
    Thanks again
    Darren

  • Subform instances problem

    I have a subform that reads data from an XML data file.
    For every instance of an XML data elelment - I want a new instance of the subform with the associated data -
    I cannot seem to get this to work - after many attempts.
    from the Live Cycle UI - The for It appears to be working , at least, the bindings are correctly indicating the right information for the subform - but the object palette is grayed out and I can't seem to figure out how to instruct the subform to re-instantiate for every occurrence of a particular XML data element.  It reads the first element encountered , one only .... and misses all other occurrences of the data element.
    would it be possible to zip up the form and the xml data file and submit it for a review -
    the form is actually rather simple - so this is even more frustrating  (Arggh)
    Thanks

    Thaks Paul ;
    I have sent the form and the data file - to the email yo listed.
    The form is signed, etc - and works normally - but i can' identify the issue for the subform instances -
    I gave it my best effort -
    Thanks for assisting .

  • Add Subform Instance

    Hi there,
    Would it be possible for someone to help with a problem I'm having trying to add a subform instance? I've looked at an example and tried to use the same method but for some reason cannot get it to work and I've no idea why! Happy to send the form if that helps.
    Any help greatly appreciated,
    Thanks.
    Ken

    //_<subformname>.addInstance(1); //is syntax do not get confused it starts with underscore followed by subform name (no need to give entire hierarchy)
    //and the number 1 in the parenthesis adds one instance if use 2 two new instances are added
    //check the example below
    // Invoke the Instance Manager to add one instance of the detail subform.
    _Section2Detail.addInstance(1);
    //Invoke the recalculate method to include the field values from the added subform in calculations.
    //add to forec the layout manager to redraw screen
    xfa.form.recalculate(1);
    if you still run into issues do email me copy at n_varma(AT)lycos.com.
    Good luck,

  • Adding subform instance - paging issue

    Hi,
    I have a form which includes a subform where one can press a button to add a subform instance.
    The subform is located in the middle of the page, with a small subform below it. 
    When I presss the add button to add the subform, the subform below the added subform goes to a new page.  I don't know why its doing this as there is plenty of room below the lower subform before the end of the page.
    I recently added data fields to the form.  Before I added the data fields, when I would press the add subform button, the subform below would not go to a new page.
    Any ideas?
    Andrew

    Just a thought but does your form content area extend to the bottom of the page or does it end at the same place the bottom subform ends?

  • Making Subform Instances Visible/Invisible

    Hello,
          I am trying to loop through the Subform Instances of the form and trying to make them visible/invisible on the click of a Check Box. The script seem to run just fine but the values nothing happens to the subforms. The script is written on the CLICK event of check box and is as below:-
    ----- HAP_DOCUMENT.APR.HAP_DOCUMENT.Positions.DATA.CHECK_BOX::click: - (JavaScript, both) ----------
    var
    nCount = APR.HAP_DOCUMENT.T_ELEMENTS.DATA.instanceManager.count;
    //var plan_value = this.parent.PLANS.rawValue;
    var
    plan_value = this.parent.parent.parent.Storage_Form.PLANS.rawValue;
    for (var nItem = 0; nItem < nCount; nItem++) { // Begin Loop T_ELEMENTS after the Instance is created
    var sub_Tele = "HAP_DOCUMENT.T_ELEMENTS.DATA["+ nItem +"]";
    var tName = "HAP_DOCUMENT.T_ELEMENTS.DATA["+ nItem +"].T_COLL_CELL.DATA";
    var sCount = xfa.resolveNode(tName).instanceManager.count;
    for (var sItem = 0; sItem < sCount; sItem++) { // Second Loop on T_COLL_CELL
    var fName = "HAP_DOCUMENT.T_ELEMENTS.DATA["+ nItem +"].T_COLL_CELL.DATA["+ sItem +"].T_FIELD.DATA";
    var tCount = xfa.resolveNode(fName).instanceManager.count;
    for (aItem = 0; aItem < tCount; aItem++){ // Third Loop on T_FIELD
    var gName = "HAP_DOCUMENT.T_ELEMENTS.DATA["+ nItem +"].T_COLL_CELL.DATA["+ sItem +"].T_FIELD.DATA["+ aItem +"].simpleField.VALUE_STRING";
    var lName = "HAP_DOCUMENT.T_ELEMENTS.DATA["+ nItem +"].T_COLL_CELL.DATA["+ sItem +"].T_FIELD.DATA["+ aItem +"].simpleField.CAPTION";
    var subName = "HAP_DOCUMENT.T_ELEMENTS.DATA["+ nItem +"].T_COLL_CELL.DATA["+ sItem +"].T_FIELD.DATA["+ aItem +"]";
    var aVal = xfa.resolveNode(gName).rawValue;
    var bVal = xfa.resolveNode(lName).rawValue;
    var subVal = xfa.resolveNode(subName).presence;
    if (bVal == "Position Number"){
    if (aVal == plan_value) {
    if ( this.rawValue == 1) {xfa.resolveNode(subName).presence
    = "visible";}
    else {xfa.resolveNode(subName).presence
    = "hidden"; }
    Is there any other way of addressing the properties of the Subform Instances? Could any please help me as to why there is no effect on the subforms?
    Regards,
    Shishir.P

    Is the form saved as dynamic? Are you getting any errors in the javascript console?
    Paul

  • Problem with Subform Instances at First Opening

    Hi All,
    I have a large, complex form that has several subforms that I need to have zero instances the first time the form is opened. Most of those subforms that I set the initial instances = 0 on the Object pallet do exactly that--they behave and open with zero instances! However, I have one subform that always starts with an instance (1 instance instead of zero instances). I really don't want to work-around this, as I have done in the past when this has heppened. I want to solve it.
    I have tried
    Unwrapping the subform and the re-wrapping in a new subform
    Manually editing the <occur/> element in the XML for the subform.
    repeatedly trying different things in the Object pallet--the initial count checkbox always reverts to unchecked and the count to blank--I actually see it un-checking itself and removing the "0", right after I return to Design View from the Preview. This even happens after I have manually set the values in the XML. I double-check the Object pallet to see that my edits are reflected there (they are) and then... upon returning from Preview, it reverts and my <occur/> edit vanishes.
    I have looked for scripts that might be causing this--without any luck.
    I have encountered this sort of thing before and finally gave up and used the "presence" property as a work-around. The subforms don't always get utilized by the user and they should only exist when the user needs them. I will be exporting the XML data out of this form and exporting a lot of empty elements just presents another problem I'd like to avoid.
    Any suggestions are most welcome. I hope someone knows of a solution--I have spent way too much time on this.
    Cheers,
    Stephen

    Hi,
    Thanks kjaeggin and Bruce,
    I have the checkBoxes unchecked and the occur element is <occur min="0" max="-1"/> .
    Actually, this is the way the checkBoxes and XML have been all along and the results are what what I have previously described.
    One of my attempts to fix this was manually adding the "initial" attribute to the <occur/> element (by directly editing since it won't stick in the Object pallet)
         <occur min="0" max="-1" initial="0"/> that the edit reverts to <occur min="0" max="-1"/>.
    Also I have tried
         <occur min="0" max="1" initial="0"/> this is what I really want (max="1") and it reverts to <occur min="0" max="-1"/> as well
    And
         <occur min="0" max="1"/> reverts to <occur min="0" max="-1"/>
    The documentation for scripting the "initial" property of an object says:
         "This property should be used only for printed and static forms."
    This doesn't make sense to me because static forms don't have repeating containers, so why would you need/use it?
    Finally, to rule out that there is a script or property within mySubform causing this, I have set the presence property for all the subforms contained within mySubform to Inactive (Exclude from form processing) leaving only a single static object to be rendered if there is an instance of mySubform. (Bruce, I am not sure you have this on LCD 9. It is in ADEP Designer 10 and is supported by the target version). The result is the same--I see the first static object GrandParent.Parent.mySubform.staticObject but when I add a GrandParent I see GrandParent.Parent.nothingElse -- the added GrandParent doesn't have a mySubform. So it only misbehaves when the form is first opened, not when a GrandParent is added.
    I have removed global bindings from the few objects in mySubform that have them--no change. I have commented out the 1 script in mySubform that runs at form:ready--no change. I am going to look at scripts outside mySubform that get values from objects within mySubform, to see if somehow that is where the answer is. I would think that scripts would impact new instances of GrandParent, as well. I've looked at all other form:ready scripts and none interacts with or get values from mySubform.
    I think I may just have to settle for a work-around. Sure would like to know whats going on here, though.
    Thanks,
    Stephen

  • Problem with Subform Instances at Form Opening

    Hi All,
    I have a fairly large complex form that has several subforms that I want to have zero instances the first time it is opened. Most of those subforms that I set the initial instances = 0 on the Object pallet do exactly that--they behave! However, I have one subform in particular that no matter what I do, it always starts with an instance. I really don't want to work-around this, as I have done in the past when this happens. I want to solve it.
    I have tried
    Unwrapping and the re-wrapping in a subform
    Edited the <occur/> element in the XML for the subform.
    repeatedly trying different combinations of min count, max and initial count values in the Object pallet--the initial count checkbox always reverts to unchecked and the count to blank--I actually see it un-checking itself and removing the "0", right after I return to Design View from the Preview. This even happens after I have manually set the values in the XML, double-checked the Object pallet to see that my edits are reflected there (they are) and then... upon returning from Preview, it reverts and my <occur/> edit vanishes.
    I have searched for some offending script that might be causing this--but there is nothing that fires automatically tied to the instances of the subform. There are initialize, formReady and calculate scripts on objects in the subform, but nothing tied directly related to the instances of the subfom?
    I have encountered this sort of thing before and used the "presence" property as a work-around. I will be exporting the XML data out of this form and I don't want a bunch of empty elements to deal with.
    Any suggestions (besides "have you considered being a gardener?") are most welcome. I hope someone knows of a solution--I have spent way too much time on this.
    Cheers,
    Stephen

    Hi All,
    I have a fairly large complex form that has several subforms that I want to have zero instances the first time it is opened. Most of those subforms that I set the initial instances = 0 on the Object pallet do exactly that--they behave! However, I have one subform in particular that no matter what I do, it always starts with an instance. I really don't want to work-around this, as I have done in the past when this happens. I want to solve it.
    I have tried
    Unwrapping and the re-wrapping in a subform
    Edited the <occur/> element in the XML for the subform.
    repeatedly trying different combinations of min count, max and initial count values in the Object pallet--the initial count checkbox always reverts to unchecked and the count to blank--I actually see it un-checking itself and removing the "0", right after I return to Design View from the Preview. This even happens after I have manually set the values in the XML, double-checked the Object pallet to see that my edits are reflected there (they are) and then... upon returning from Preview, it reverts and my <occur/> edit vanishes.
    I have searched for some offending script that might be causing this--but there is nothing that fires automatically tied to the instances of the subform. There are initialize, formReady and calculate scripts on objects in the subform, but nothing tied directly related to the instances of the subfom?
    I have encountered this sort of thing before and used the "presence" property as a work-around. I will be exporting the XML data out of this form and I don't want a bunch of empty elements to deal with.
    Any suggestions (besides "have you considered being a gardener?") are most welcome. I hope someone knows of a solution--I have spent way too much time on this.
    Cheers,
    Stephen

  • How to reorder / move new pages and subform instances

    I have a form that has 2 functions - show a hidden page and duplicate the Page 1 and I need to reorder the pages once the user has added an instance or shown a page. I have Form A (Page 1) that can be duplicated but the user can add in a Form C (extra page) to be attached at the end of that instance of Form A.  So it goes like this:
    Form A (Page 1)
    button 1 - Adds new page 2 "Form C" to end of that "Form A"
    if (CompleteFormC.rawValue == 1) then
       topmostSubform.FormC2.presence = "visible"
       xfa.host.pageDown();
    else
       topmostSubform.FormC2.presence = "hidden"
    endif
    button 2: Adds a new instance of "Form A"
    topmostSubform.FormA.instanceManager.addInstance(1);
    xfa.host.pageUp();
    Currently, it adds the Form C to the very end, like so:
    Form A
    Form A
    Form A
    Form C
    Form C
    Form C
    I am trying to reorder the pages so the user can add in a Form C to every instance of Form A, like so:
    Form A
    Form C
    Form A
    Form C
    Form A
    Form C
    It's a little complicated but I would appreciate any help at all!

    Ahh, thank you. I just moved Form C into Form A subform group, it works and stays attached to that instance of Form A. Here's another issue... now that I have Form C appended to Form A, when I add in another Form A it correctly gets added after the last Form C but how can I get the form focus to go to the top of that new instance of Form A?
    Currently I am using: xfa.host.pageDown()
    But now it would be skipping down a few pages. Is there a way to also move to the top of that new instance?
    Thanks!

  • Referencing a instance inside a Class

    Hi --
    I am working on converting a movie clip to a Class so that I
    can more easily
    reuse it in later projects.
    I have pretty succesfully converted my AS code from my
    include file to a
    Class file. However, I have two objects on the stage, topBG
    and botBG and
    whenever I reference these items inside my code, such as
    botBG._y I get an
    error at compile time saying "There is no property with the
    name 'botBG'"
    How can I set it so these assets can be referred to inside my
    code?
    The code worked fine when it was just a movie.. Also, this is
    ActionScript
    2.0.
    Thanks
    Rich

    Hi --
    Thanks for responding. What I had created was this:
    I have a movie clip, "MainClip" with two movie clips ("ClipA"
    and "ClipB")
    inside that clip.
    I put MainClip on the stage (_root) and had Actionscript code
    in the main
    time line. I referenced ClipA & ClipB this way:
    MainClip.ClipA
    MainClip.ClipB
    Now, I want to turn MainClip into a class, "classMainClip".
    However, having
    moved the Actionscript into the class AS file and changed the
    above
    reference to just
    ClipA
    ClipB
    I get an error at compile time.
    How do I refer to the movie clips, "ClipA" and "ClipB" inside
    the
    actionscript that is the over lying class of which I want
    these clips to be
    a part?
    Hopefully I've explained this right.
    Thanks,
    Rich
    "kglad" <[email protected]> wrote in message
    news:gibuh8$qbh$[email protected]..
    > you want class instances to be able to reference each
    other?

  • Capturing data from additional subform instances

    I have a form with push buttons to add and delete additional instances of a subform containing fields. WHen I distribute the form and the form is returned, any additional instances of the subform are not captured and added to the dataset. Any ideas?
    Thanks for your help....
    Lane

    Thanks Niall for the prompt response.  I had actually come across both examples in my searching, however my form contains one table on a page.  If the user clicks a button (Add Another Location) the form replicates this page (along with a number of other pages, thus giving me a new blank table).  It is at this point that I would like the option of being able to copy the data from the first table instance into the second and so on but only if needed (hence the idea of using a checkbox to trigger the process).
    Hope this sheds a little more light on my problem.
    If this is somewhat confusing I'm more than happy to send you a copy of the file so you can have a look.
    Regards
    Michael

  • Schema binding, add new subform instance

    I'm creating a fairly simple form which has an unknown amount of grouped entries. I made a data connection to my schema and used "Generate Fields" to bring the fields into the document bound to the schema.
    If I do this multiple times using each instance as a subform I can get a nice xml doc out of it ripe for digestion like so:
    <root>
         <entry>
              <data1>
              <data2>
              <data3>
         </entry>
         <entry>
              <data1>
              <data2>
              <data3>
         </entry>
    </root>
    However, I don't know how many entries the client will be adding so I want to have a button that adds a new instance of the bound data as done manually before. I have been able to prove the concept with a static subform using _Subform1.addInstance(1) on a button.
    When I try to apply it to the bound data subform, nothing happens, no error, no new instance. Also the Repeat Subform for Each Data Item area is greyed out in the Object Binding for the Schema-ed subform.
    Does anyone have an idea about what's going wrong here?
    Thanks in advance,
    Kevin

    Few things to check here.
    1) The parent subform needs to be set to Flowed. Then you should get the Repeat Subform for Each Data Item enabled for you.
    2) The form should be saved as dynamic.
    Let me know if you still have issues. If so, send the form to [email protected] so I can have a look at it..
    Thanks
    Srini

  • Subform instances and data missing in email submitted pdf

    I have created a form in which a user can add instances of a subform, enter data, and submit it to an email address as a pdf. When I receive the form the instances are missing. What steps do I need to follow to ensure that all of the data that is entered is sent? Thank you.
    Stephen

    I made sure "Preserve Scripting changes" was set to automatic. And still when I save the form, the instances are not saved.
    Basically I have a main page with several checkboxes that open instances of different types of order forms. It works great in PDF View, but when I save the form with data filled in, only the First page and data are saved and the instances of the other forms do not show up.

  • Problem: Adding subform instances

    Hello,
    I'm trying to add some instances of a subform.
    Therefor I added the Instance Control Button to my form.
    I customized it to my form and tested it.
    But when I click the Button, nothing happened. After 5 times, a message opened, that I have reached the limit of instances. But no instance is visible.
    What could be the problem?
    Alternative: Can I programmatically change the minimum count of repeats of the subform? It's possible that I could calculate, how much lines I need. So that is the second chance.

    I solved my problem.
    The reason that instances that were added did not show is because there were positioned subforms below where I was adding instances and they covered up new instances because they did not move.
    I solved the problem by re-organizing the form.
    1. All objects were put in a positioned sub-form. Some of them were in a subform by themselves.
    2. Each positioned subform was wrapped in a flowed subform with flow direction Western Text. The flow direction probably doesn't matter here because the flowed subform has only one object in it.
    3. The page-level subform was made flowed, direction western text.
    4. The form must be saved as a dynamic form.
    When I added instances, everything moved down correctly.
    You can probably not wrap everything in positioned subforms first, but you have to account for LiveCycle left-justifying everything in flowed subforms by putting blank text boxes to act as spacers to keep fields in place.

  • Inserting multiple subforms instances with app.response on click event.

    I could use some help sorting out this click event. I can't seem to get it to work the way I need it too. I have tried a few different variations with no success. The part I am having trouble with is in the loop and inserting multiple copies based on user input from the app.response event. I have a version of script that works with no loop but that won't allow functionality for inserting multiple instances of the subform. Would appreciate any help figuring out how I can do this.
    var cChoice = app.popUpMenu("Add a blank section",  "Copy this section", "-", "Delete this section");
    if(cChoice == "Add a blank section"){
    ACT.instanceManager.addInstance(1)
    } else if(cChoice == "Delete this section"){
    ACT.instanceManager.removeInstance(this.parent.instanceIndex)
    }else if(cChoice == "Copy this section"){
    var cResponse = app.response("How many instances of this section would you like to insert?",["Copy current section",])
    if (cResponse == null)
    app.alert("No copy of the current section was inserted due to a null response.");
    else
    var i=ACT.instanceIndex
    var j=0
    while(j<cResponse)do
    _ACT.addInstance(1)
    xfa.resolveNode("form1.Subform1.ACT[" +(i+1) + "].Row1.textField").rawValue = xfa.resolveNode("form1.Subform1.ACT.Row1.textField").rawValue

    Hi,
    You code has got a bit mangled , but maybe something like;
    var cChoice = app.popUpMenu("Add a blank section",  "Copy this section", "-", "Delete this section");
    if(cChoice == "Add a blank section")
        ACT.instanceManager.addInstance(1)
    else
    if(cChoice == "Delete this section")
        ACT.instanceManager.removeInstance(this.parent.instanceIndex)
    else if(cChoice == "Copy this section")
        var cResponse = app.response("How many instances of this section would you like to insert?",["Copy current section",])
        if (cResponse == null)
            app.alert("No copy of the current section was inserted due to a null response.");
        else
            var i=ACT.instanceIndex
            var j=0
            while(j<cResponse)
                var act = _ACT.addInstance(1)
                act.Row1.textField.rawValue = xfa.resolveNode("form1.Subform1.ACT.Row1.textField").rawValue
                j++;

Maybe you are looking for

  • Partial Goods Receipt

    Hi, Is it possible in SAP Business One to create a partial Goods Receipt of a service from a purchase order? Thank you. Nadia.

  • Accounts Payable Check

    I have two questions with regards to an RTF template for a AP Check; 1) How to get the signature files to display when I preview the check. I have uploaded the signatures and can view them via a URL. Should the signatures display when I preview my ou

  • Profit Center Value in the Purchase Order Pricing

    Dear Friends I am stuck at a process design step and I need your help to proceed further. We have created a new Condition type in MM Purchasing to display the charges incurred towards the inward freights. These freight costs vary depending on the Pro

  • How to synchronise my MacBook Air to my Imac

    Hello When I go to my office, I take my MacBook Air When I come back home, what i have done on my MacBook Air is not on my IMac at home. How to synchronise both, so that I can find the emails I have been wroten, the files I have done etc...

  • Close ADF Popup Dialog with html button in Inline Frame

    hi, I'm using jdev 11.1.1.2, I have a adf popup dialog which contains an Inline Frame(source is a jsp file).I want to close the dialog with a html submit button in the frame page. when the submit button is clicked, auto close the dialog. can anyone h