Can You Specifiy Optional Attributes/Fields within Repeating Table? - InfoPath Dev
in

InfoPath Dev

Can You Specifiy Optional Attributes/Fields within Repeating Table?

Last post 05-28-2008 11:10 AM by Albert. 4 replies.
Page 1 of 1 (5 items)
Sort Posts: Previous Next
  • 05-15-2008 03:22 PM

    • tbianco
    • Not Ranked
    • Joined on 05-15-2008
    • Fife, WA
    • Posts 4

    Can You Specifiy Optional Attributes/Fields within Repeating Table?

    Hi there I'm new to infopath and I'm currently using InfoPath 2007. I have a base xml file that I'm using for my schema. In this xml file I have positioning data such as x, y, z, and width (w), heighth (h) etc.

    I was thinking that I could use the xml schema to create several views in that in one view I will create an xml structure that has only x,y,z attributes and other view that only has my w,h attributes included into the generated xml file as I don't want to have all the attributes into the generated xml files only the ones that pertain to the view.

    For example I have an xml base file structure and wanted to generate the following three xml files from the same base template but with different views and ensure that only the attributes for the two alternate views are included.

    <!-- Base view -->
    <parent>
       <child x="" y="" z="" w="" h=""></child>
    </parent>

    <!-- x,y,z only view -->
    <parent>
       <child x="" y="" z=""></child>
    </parent>

    <!-- w,h only view -->
    <parent>
       <child w="" h=""></child>
    </parent>

    Is that a possibility and is there a setting that will allow me to do this?

     Thanks,
    Tony

  • 05-16-2008 08:09 AM In reply to

    Re: Can You Specifiy Optional Attributes/Fields within Repeating Table?

    Not sure I completely understand but...

    You would have one XML structure per template.

    Within that template you can have multiple ways to view the XML data.

    So you definetly can have a view for just part of the data and another for others. You can identify each user or form state or data already entered and automatically route to specific views as needed.

    You also could create these three seperate sub-schemas within your main form schema and copy data as it is entered to keep them insync possibly.

  • 05-16-2008 11:49 AM In reply to

    • tbianco
    • Not Ranked
    • Joined on 05-15-2008
    • Fife, WA
    • Posts 4

    Re: Can You Specifiy Optional Attributes/Fields within Repeating Table?

    Basically I want to use one infopath form that has an xml file with width (w), height (h), x, y, and z attributes. I want to use this base xml file and solution and I would like to create several views, in which one view will only show, populate, and generate just the width and height attributes, and the other view to only show and generate an xml file that has the x, y, and z attributes populated.

    So instead of creating three xml data structures and solutions I'm wanting to use one base xml data structure and base solution that will have several views that will generate only a select amount of attributes instead of having all of the attributes generated. It's not about using a view to show the attributes it's about generating the xml.

     
    Does that clarify things?
     

  • 05-27-2008 01:21 PM In reply to

    • tbianco
    • Not Ranked
    • Joined on 05-15-2008
    • Fife, WA
    • Posts 4

    Re: Can You Specifiy Optional Attributes/Fields within Repeating Table?

    Instead of basing the xml output through views is there a way where you can just make all the attributes within an xml file optional and have the xml that the infopath generates only generate attributes that have values in them?

  • 05-28-2008 11:10 AM In reply to

    • Albert
    • Top 500 Contributor
    • Joined on 04-03-2008
    • The Netherlands
    • Posts 32

    Re: Can You Specifiy Optional Attributes/Fields within Repeating Table?

    You can do this if you are using code, there are afaik three appoaches:

    1. Start with everything and delete everything that not has a value when you save the form
    2. Start with nothing and add the fields you need.
    3. Ignore the empty field and/or look at the xsi-nil="true" property
    Approach 1 is default in InfoPath. I never did something like this, but should be possible with selectSingleNode and a delete/remove function.
    You could delete the fields on a submit and/or save event.
     
    Using ' Tools -> Default Values' you can disable fields/groups. For example, if you disable everything, open the form in 'Fill out a form-mode' save the form, you will end up with an xml file with only a root. Then you should manually add the fields you need using code. I just made a post about how to do this using BLOCKED SCRIPT http://www.infopathdev.com/forums/t/7964.aspx.
    Probably the hardest part is when to insert the actual fields/groups. And be careful not to do it twice.
     
    I think i'd rather prefer third option, but if you have no choice you might end up doing one of the first.
    Also remember you always need to specify all the fields you want to use later (x,y,z,w,h)  in designmode.
    Albert
Page 1 of 1 (5 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.