Display list in dropdown box based a selcted item from another dro

P

Peter

Hi All

I have had a look to see if this query exists but cant see it.

I have two dropdown boxes and in the first I have it populated with the
departments within our company. Because some of our departments have
divisions I would like to dispay onlys those divisions based on a selected
department.

So for example our department Cusomnter Servces has three divisions,
Furniture, Print and Equipment. So if an employee selects Customer Services
another dropdown list appears displaying thre three divisions or sub
departments. Obviously, if a department selected does not have sub
departments the next box need no appear.

Is this possible?

Kind Regards

Peter
 
S

Scott L. Heim [MSFT]

Hi Peter,

This is entirely possible but the complete answer will depend on where you
have your drop-down list boxes being used - so before I provide the steps,
I wanted to clarify an item with you: are your drop-down boxes simply
placed on your form or are they in a Repeating Section or Repeating Table?

Thanks,

Scott L. Heim
Microsoft Developer Support

This posting is provided "AS IS" with no warranties, and confers no rights.
 
P

Peter

Hi Scott

My drop-down boxes are just placed on the form, in a simple table.

Kind Regards

Peter
 
S

Scott L. Heim [MSFT]

Hi Peter,

Thanks for the clarification. And please accept my apologies as there was
one other item I neglected to ask: where do the entries in each drop-down
box come from? In other words, are the data sources for the drop-downs a
table from a database, an XML file or have you hard coded the values in
both boxes?

Thanks again,

Scott L. Heim
Microsoft Developer Support

This posting is provided "AS IS" with no warranties, and confers no rights.
 
P

Peter

Hi Scott

No problem. Initially these have been hardcoded - but I was looking to use a
table in a database?

Kind Regards

Peter
 
S

Scott L. Heim [MSFT]

Hi Peter,

A table would be good - just keep in mind these tables will need to be
"related" in order for this to work.

I would like to ask you to complete these steps using the Microsoft Access
Northwind sample database - this way you can see this work properly and
then migrate this to your application.

1) Create a new, blank InfoPath form
2) Add a drop-down list to the form named: ddlSuppliers
3) Add a drop-down list to the form named: ddlProducts
4) Add a new "Receive" data connection (Tools->Data Connections) to the
Northwind database using the Suppliers table. (Note: you will only need the
SupplierID and CompanyName fields.)
5) Add a new "Receive" data connection (Tools->Data Connections) to the
Northwind database using the Products table. (Note: you will only need the
ProductID, ProductName and SupplierID fields.)
6) Right-click on ddlSuppliers and choose Properties
7) On the Data tab select the option "Look up values in a data connection
to a database..." under the section "List Box Entries"
8) Set the Data Connection to Suppliers
9) Click the button next to the Entries box, highlight "d:Suppliers" and
click OK
10) Leave the Value field as: @SupplierID
11) Click the button next to Display name, highlight CompanyName and click
OK
12) Click OK to close the Properties window
13) Right-click on ddlProducts and choose Properties
14) On the Data tab select the option "Look up values in a data connection
to a database..." under the section "List Box Entries"
15) Set the Data Connection to Products

** NOTE: These next steps are important for the filtering! **

16) Click the button next to the Entries box, highlight "d:products" and
click the Filter Data button
17) Click Add
18) In the first box, select SupplierID
19) In the second box, select "Is Equal To"
20) In the third box, choose Select a Field or Group
21) From the Data Source box choose Main
22) Highlight ddlSuppliers and click OK
23) Click OK three times to get back to the Properties window
24) Leave the Value field as: @ProductID
25) Click the button next to Display name, highlight ProductName and click
OK
26) Click OK to get back to your form

** NOTE: These next steps are important for clearing out the previous
entries in ddlProducts once a new selection is made from ddlSuppliers! **

27) Right-click on ddlSuppliers and choose Properties
28) Click the Rules button
29) Click Add
30) Click Add Action
31) From the Action box choose Set a field's value
32) Click the button next to Field, select ddlProducts and click OK
33) Leave the Value field blank
34) Click OK four times to get back to your form
35) Preview your form and make a selection from ddlSuppliers - you should
only see a few items in the Products list.
36) Make a different selection from ddlSuppliers - you should now have a
different list of Products!

I hope this helps!

Best Regards,

Scott L. Heim
Microsoft Developer Support

This posting is provided "AS IS" with no warranties, and confers no rights.
 
S

Scott L. Heim [MSFT]

Hi Peter,

Glad to be of help! :)

Take care,

Scott L. Heim
Microsoft Developer Support

This posting is provided "AS IS" with no warranties, and confers no rights.
 
D

Denniso6

Hi Again Scott !!

I definately agree with Peter !!

Have a couple of questions regarding the solution above:

1). Using the database data source method, must MS Access alway be used or
are there other options such as MS Excel, text file, etc. If so, can you
provide the steps to create these files.
2). Also..., say it comes to publishing the form to a SharePoint Forms
Library..., how does one include the supporting database or table file...,
(where would the database or table file live ?)

Thanks again for all you assistance.

DennisO
 
A

Ana

Hi Scott,
I need a help related with this topic. I have similar situation but my drop
down boxes are placed in a repeating section and the data sources are two
tables in a database in SQL Server 2005. This tables are connected by a
column/field with data type integer and this field in one table is the
primary key.

Can you tell me how can I do it?

Thank you.
Kind Regards.
 
N

Needo, SharePoint Developer

Hi Scott in may case at point 16 while clicking filter data, uts show me
message: "filitering data is not supported in browser enabled forms", i have
to use these for in workflow in share point.

I have attached sharepoint user list as data source and mentioned "office" in
frist dropdown list
with 2nd dropdown list attahed are "user names".

i want to chnge selected users in ddl2 as seletected office in ddl1

any help?
 
B

Batman

My situation is a little different.

How can I pass different set of static values to the product list from
different suppliers within a repeating frame?
 

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