Drop-down list resetting when filtering secondary datasource

S

sirwally

This is odd. I have a drop-down list that is populated from a secondary
datasource. In this case, a participant's ID is the value and their name is
what is displayed. I want to store their name in another main datasource
element, so I created a rule that finds the matching element in the same
secondary datasource to which the drop-down is bound by filtering on the ID.
However, when an item is selected the drop-down just resets to the first
(blank) item, and the other element is never set to anything.

Here is the XPath being used:

xdXDocument:GetDOM("Participants - Requesting
Managers")/dfs:myFields/dfs:dataFields/dfs:participants_-_Requesting_Managers/@Name[../@BadgeID
=
xdXDocument:get-DOM()/my:AFE/my:GeneralInformation/my:RequestingManagerBadgeID]

I'm confused. I've searched everywhere but all I have found was an example
of how to do exactly what I did
(http://blogs.msdn.com/infopath/archive/2004/09/10/227972.aspx), and
apparently it should work...Hopefully this is one of those times when I end
up slapping my forehead when I find the problem ;-)

Anyone have any ideas?


On a side note, I hope that InfoPath 2007 creates more efficient filters.
i.e.

xdXDocument:GetDOM("Participants - Requesting
Managers")/dfs:myFields/dfs:dataFields/dfs:participants_-_Requesting_Managers[@BadgeID
=
xdXDocument:get-DOM()/my:AFE/my:GeneralInformation/my:RequestingManagerBadgeID]/@Name

While this works the same way, it breaks the GUI, which will no longer see
the filter. No biggie, but I have actually run into situations where this
can make a huge performance difference.
 
G

Greg Collins [InfoPath MVP]

A drop-down list has a display value and a stored value... sounds like your stored value is not pulling an actual value, which is why blank is being selected.

For your side note, I don't believe that has been fixed, nor will any time soon. Sorry - a complaint of mine too!!
 
S

sirwally

I _think_ the problem is because of when the item in the drop-down is
actually selected. I could not for the life of me make this work (either via
a rule on the drop-down or via an expression in the target element). What I
ended up doing was using the onAfterChange() event of the drop-down instead
and wrote code to do it, which works perfectly. It appears that when the
rule fired the value of the drop-down was still blank, indicating to me that
the item selection had not yet been finalized.

Shame about the side note :-(

Thanks Greg :)

Simon.
 
G

Greg Collins [InfoPath MVP]

I'm glad you got it working with code. Just as a follow up, rules fire AFTER the change is complete. So the new value should be available to the rule. Not sure what the issue was with that for you.
 

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