Including static xml data in infopath form - InfoPath Dev
in

InfoPath Dev

Use our Google Custom Search for best site search results.

Including static xml data in infopath form

Last post 10-23-2012 12:09 PM by Hilary Stoupa. 8 replies.
Page 1 of 1 (9 items)
Sort Posts: Previous Next
  • 10-22-2012 06:13 AM

    Including static xml data in infopath form

    I have looked around the forum, but could not find an answer to this question, though I realize I may be asking the wrong question.

    I am an IT project manager and I have projects that require me to submit travel costs to our customers. For our government customers I have to ensure that costs do not exceed the Federal Travel Regulations. The costs vary from month to month and I'd like to include the static costs for each month in my form so that when I apply my XSL style sheet against it I can perform checks to make sure that we are in compliance.

    Here is an example of what I'd like to include in each submitted form:

    <PerDiem>
    <Rate start="10/1/2011" end="10/31/2011">248.60</Rate>
    <Rate start="11/1/2011" end="2/28/2012">201.30</Rate>
    <Rate start="3/1/2012" end="6/30/2012">246.00</Rate>
    <Rate start="7/1/2012" end="8/31/2012">185.90</Rate>
    <Rate start="9/1/2012" end="9/31/2012">248.60</Rate>
    <MealStart>53.25</MealStart>
    <MealDuring>71.00</MealDuring>
    </PerDiem>

     However, I cannot figure out how to include this in the form. I was thinking it would just be a hidden entry that the employee never sees and would not be visible on the form, but I am open to suggestions.

     

    Thanks!

    Filed under: , ,
  • 10-22-2012 06:30 AM In reply to

    Re: Including static xml data in infopath form

     In Infopath Designer, Data tab on ribbon > Resource Files button under Form Data

    Gennady Vanin (Novosibirsk) --- Геннадий Ванин (Новосибирск)
  • 10-22-2012 07:59 AM In reply to

    Re: Including static xml data in infopath form

    Gennady's suggestion would allow you to include that info as a secondary data source in the form template - however, if you need that XML with the saved XML from filling out the form (it sort of sounds like you do), you can just add the fields to the main data source (no need to include controls on the form). For your repeating Rate field, under the Data tab on the Ribbon, look for the Default Values - you can additional instances of the node, each with their own default value.
    Hilary Stoupa

  • 10-22-2012 10:53 AM In reply to

    Re: Including static xml data in infopath form

    Thank you for the answer, but I am still having difficulting. When I try to create another field under the main datasource, it says I already have one with that name and I have to choose another name.

    Filed under: ,
  • 10-22-2012 11:10 AM In reply to

    Re: Including static xml data in infopath form

    Make the field repeating. Then, instead of creating another instance of it in the data source task pane, go to Data --> Default Values. Add additional instances there.
    Hilary Stoupa

  • 10-23-2012 06:45 AM In reply to

    Re: Including static xml data in infopath form

    Ok, that worked perfectly, thank you!

    I did see references about the default values, but did not realized I could add new instances from that Default Values interface.

    So, now, is there a way to populate the default values with a resource file? I keep a separate xml file with all of my form values and I am thinking about creating a form to allow me to maintain this resource file. But if I have to update the default values by hand each time, that will reduce its value to me.

     Thank you again for answer to my previous question!

    Filed under: ,
  • 10-23-2012 08:42 AM In reply to

    Re: Including static xml data in infopath form

    The problem you'll have with that is that some of your default values are in a repeating group. If you add a "helper" field in the same repeating group, it will make it easier. I'm attaching a sample - it is easier to show than explain - form rules are on "reset" field in group2 and in form load.

    Right click the link in the heading of this post, and save the file locally. Right click the saved template and select design to open in design mode. From there you can preview. My resource file is included with the form, but you could just as easily do this with an XML that is external.

    Hilary Stoupa

  • 10-23-2012 12:00 PM In reply to

    Re: Including static xml data in infopath form

    Ok, it took my a while to replicate. I didn't realize that it was putting in the default "my:" namespace and so the formulas wouldn't work until I figured that out. So, now can I have a rule that iterates the rates and populates a control on the form with the correct rate depending on the calendar date of the expense. Then I wouldn' have to do this calculation in my style sheet.

     

    By the way, I am really thankful for all of your help.

    Filed under: ,
  • 10-23-2012 12:09 PM In reply to

    Re: Including static xml data in infopath form

    So - you are all set? That's great news!
    Hilary Stoupa

Page 1 of 1 (9 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.