You may download the files used in this blog post from this link.
Overview
Sometimes you have a form and you want to show another form's
data, without actually copying it into your form.
In other words, you don't want to include the queried form into
your form. You just want to link the forms together and show the related form
as a reference.
How do you add this "satellite" form to your main form
without impacting the design of your main form?
In this blog, we'll show you how to query and display data from a
separate satellite form without ruining the integrity of your main form.
Requirements
You are a site collection admin.
Your site has the FormsViewer App
installed, or your SharePoint admin can install it.
You have an InfoPath form or
access to InfoPath Designer to create one.
Sample Scenario = Policies
Every business process needs a policy. The policy may change
throughout the year. For example, an expense report may require receipts for
expenses exceeding $100 this year, but this limit may be raised to $150 next
year. The business process admin should be able to update the policies by
going in to the Policy library and adding/updating forms.
Usage
Scenario
View
Policy
1. User
opens up your form
2. Clicks
on Show Policy
3. If
no matching policy exists, Main form shows "No policy document"
4. If
policy form exists, Main form queries the policies form
5. Main
form displays the policy
Add
or Edit Policy
1. Business
Process Admin adds a new policy with the name for the main form which it will
target
Components
To implement, you will need the following:
Technique
Query the Policy form library using the URL for the Main form (as
if it is a unique ID to search for a policy).
Here’s how the Policy Form looks like – simple and
straightforward.
Publish your Policy
form into your SharePoint library. Submit your business process policies using
that form, specifying the Target Form Name, e.g. Expense Report, Leave Request,
etc. and entering your Policy text in the rich text field which allows
formatting, paragraph breaks, etc.
Here’s an example of a filled-out Policy form:
There’s also the Policy XTP (template part) that allows easily
adding policies into your forms. Here’s how it looks like in the Designer:
Add the XTP into your InfoPath Designer Custom Controls:
We will add the Policy XTP into the Expense Report form that ships
with InfoPath 2007.
Follow the steps provided in the XTP – we made it very simple and
user-friendly for you! J
Key notes:

The same name should be specified as the default value in the
Policy XTP section’s TargetFormName
field:


Those are all the changes needed – super easy! J
How the Magic Happens
All the
rules are placed in the Show Policy button:
We use
the following commands/technique:

We are basically telling our form to get the policy text from the
Policy Form library to the form where we added the XTP to, in this case, the
Expense Report form.

Since we’re copying to and from a rich text field, we use the
command CopyRichText in order to keep any rich text formatting.
That’s
all there is to it! When you’re done setting it up, publish your form into
FormsViewer and test out your changes.
Have fun! J