Filtering on Secondary Sources

S

stevebuy

Hopefully someone can help me with my problem.
I'll use the Northwind Database as an example.

I'm using the Supplier joined to the Products table as my Main Source.
In the Query Section, I want to select from a dropdown of all available
Suppliers so I have added a secondary Suppliers data source.
I then want to select from a dropdown of all Products associated with
that supplier. So I added a secondary Products data source
Thats where I run into problems.

My first dropdown has a rule that runs the secondary data source query.
This unfortunately return all products.
I cant seem to filter the products secondary datasource using the
chosen info in the suppliers secondary datasource.

Any help would me much appreciated.

SteveB.
 
F

Franck Dauché

Hi Steve,

Why don't you use code to filter:
string qry = "MyValue";
ADOAdapterObject oNameTable = (ADOAdapterObject)
thisXDocument.DataAdapters["tblTest"];
oNameTable.Command = string.Format("Select * from tblTest where Test = '" +
qry + "'");
oNameTable.Query();

Regards,

Franck Dauché
 
S

S.Y.M. Wong-A-Ton

Hi SteveB,

To filter the products secondary datasource using the chosen info in the
suppliers secondary datasource, do the following:

Assuming you've already set the data source for the products dropdown:
- Double-click on the dropdown showing the products to open its properties
window
- Click on the "Select XPath" button behind the "Entries:" textbox
- In the "Select a Field or Group" dialog box, click on [Filter Data...]
- In the "Filter Data" dialog box, click on [Add...]
- Select the field referencing the supplier ID in the first dropdown
- Leave "is equal to" select in the second dropdown
- Select "Select a field or group..." in the third dropdown
- In the "Select a Field or Group" dialog box, select the "Main" data source
from the data source dropdown
- Click on the field representing the dropdown for the suppliers on your
InfoPath form
- Click on [OK] to close all dialog boxes except the last one showing the
properties for the products dropdown
- You will see that the values you had previously set for "Value" and
"Display name" have been reset. Set them again to the desired fields from the
secondary data source for products

The above should show only those products corresponding to the selected
supplier in the first dropdown.

Hope this helps. If you are still having problems getting it to work, let me
know.

Cheers,
S.Y.M. Wong-A-Ton
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top