Cascading listbox entries on a repeating section

I

InfoHound

I had a breakthrough with populating a secondary listbox based on a user
selection in a primary listbox. Both boxes are on a repeating section and
the functionality works great, but only for the first instance of the
repeating controls.

When I click the repeating section to add a second set of entries, another
instance of the two listboxes appears (good). if I choose a different
selection in the new primary listbox, the new secondary listbox is populated
with items from both the first instance of the secondary listbox (where it
worked great) as well as the items that are filtered in second instance of
the secondary listbox (this is bad).

So, SeconaryListbox(2) = SecondaryListbox(1) + SecondaryListbox(2).

This is hard to describe, I hope the question is understandable: "How do I
prevent this listbox-content-addition from occuring?"

My form is bound to a database. Thank you for any advice.
 
G

Greg Collins [InfoPath MVP]

Check out my tutorials on repeating cascading lists:

Create a Repeating Cascading List from a Flat Data Source
http://www.infopathdev.com/howto/tutorials/default.aspx?i=075c4e8e56db4fa5bd63615b712c0d91

Create a Repeating Cascading List from a Hierarchical Data Source
http://www.infopathdev.com/howto/tutorials/default.aspx?i=9f6fda3a14c14ac4924cf0a382928432

--
Greg Collins [InfoPath MVP]
Visit http://www.InfoPathDev.com


I had a breakthrough with populating a secondary listbox based on a user
selection in a primary listbox. Both boxes are on a repeating section and
the functionality works great, but only for the first instance of the
repeating controls.

When I click the repeating section to add a second set of entries, another
instance of the two listboxes appears (good). if I choose a different
selection in the new primary listbox, the new secondary listbox is populated
with items from both the first instance of the secondary listbox (where it
worked great) as well as the items that are filtered in second instance of
the secondary listbox (this is bad).

So, SeconaryListbox(2) = SecondaryListbox(1) + SecondaryListbox(2).

This is hard to describe, I hope the question is understandable: "How do I
prevent this listbox-content-addition from occuring?"

My form is bound to a database. Thank you for any advice.
 
I

InfoHound

Greg,

Thanks so much for your help. Your tutorials are very well constructed. I
created the form with the three hierarchical listboxes and it works great.

Now I'm trying to apply the concept to my own form. I think I'm getting
mired in how to refer to a particular node of the data source.

The way I got my list boxes to work one-time-only was to make a reference
from my dependent listbox (which uses a secondary datasource) to the parent
field in my main datasource (a datafield from main, since my form is used for
submitting to a database).

I'm trying to apply the current() function, but I'm not sure how to refer to
the main datasource, group and target node. Can you provide any further
direction?
 
G

Greg Collins [InfoPath MVP]

The current() function isn't always easy to understand -- not the function itself, but what it represents. The current() function represents the node that you are currently prossessing in the XSL. But it is sometimes confusing what node that is.

Typically if you are using current() within a repeating node, it will represent the specific instance of that repeating node being displayed/workd with. And if you are using it within a particular node, it represents that specific node. Sometimes its not as straight forward as that, and I often get confused myself. I typically use trial and error, though I guess I could open the XSL file and see exactly where I'm at when I'm using it.

One you have your current node, then you following it with a regular XPath just like you would if you were using the dot node (i.e. "." -- which is another representation of current() used in different circumstances).

Have I confused you yet? Hopefully not.

So if you have a schema like:

myFields
group1
group2
field1
field2
group3
field4

and current() represents group2, and you want to reach field2 you would use:

current()/field2

if current() represents field4 and you want to reach field2, you would use:

current()/../../field2

Make sense? Hopefully. Good luck!

--
Greg Collins [InfoPath MVP]
Visit http://www.InfoPathDev.com


Greg,

Thanks so much for your help. Your tutorials are very well constructed. I
created the form with the three hierarchical listboxes and it works great.

Now I'm trying to apply the concept to my own form. I think I'm getting
mired in how to refer to a particular node of the data source.

The way I got my list boxes to work one-time-only was to make a reference
from my dependent listbox (which uses a secondary datasource) to the parent
field in my main datasource (a datafield from main, since my form is used for
submitting to a database).

I'm trying to apply the current() function, but I'm not sure how to refer to
the main datasource, group and target node. Can you provide any further
direction?




Greg Collins said:
Check out my tutorials on repeating cascading lists:

Create a Repeating Cascading List from a Flat Data Source
http://www.infopathdev.com/howto/tutorials/default.aspx?i=075c4e8e56db4fa5bd63615b712c0d91

Create a Repeating Cascading List from a Hierarchical Data Source
http://www.infopathdev.com/howto/tutorials/default.aspx?i=9f6fda3a14c14ac4924cf0a382928432

--
Greg Collins [InfoPath MVP]
Visit http://www.InfoPathDev.com


I had a breakthrough with populating a secondary listbox based on a user
selection in a primary listbox. Both boxes are on a repeating section and
the functionality works great, but only for the first instance of the
repeating controls.

When I click the repeating section to add a second set of entries, another
instance of the two listboxes appears (good). if I choose a different
selection in the new primary listbox, the new secondary listbox is populated
with items from both the first instance of the secondary listbox (where it
worked great) as well as the items that are filtered in second instance of
the secondary listbox (this is bad).

So, SeconaryListbox(2) = SecondaryListbox(1) + SecondaryListbox(2).

This is hard to describe, I hope the question is understandable: "How do I
prevent this listbox-content-addition from occuring?"

My form is bound to a database. Thank you for any advice.
 

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