Display value from secondary data source

L

Laurie_Marsh

I have a main connection to a DB that has one parent (employees) table and
multiple child tables (address, AssignedProjects, ...) linked by the key in
the parent. I have an InfoPath form allowing information for a selected
employee to be changed in the many child tables.

An employee can be assigned to >1 project so my form includes a repeating
section for that. A project within the AssignedProjects table is identified
by a key but I want the description displayed on the form (i.e. display
"Acura Toronto Windshields" as opposed to "67-23"). I have a secondary data
source for the Projects table but can only get the description displayed if I
use a drop-down list bound to the entry in the AssignedProjects table. I
want to use a read-only text box instead. (I am implementing my own
drop-down list in C# because I need it wider than what I want to allow the
actual value widget on the form. Next to the read-only text box is a button
that launches my own drop-down list.)

It seems like I should be able to bind a text box for a value in my
repeating table to a secondary data source for display purposes but nothing I
try is successful. I know I can change my data connection but I would rather
not if possible.

Thanks.
 
I

INTP56

Laurie,

This is not going to help, but I don't think you can do what you want to do,
at least without going to scripting.

The issue is how InfoPath uses the Secondary Data Source with the DropDown
List.

The Text Box is expecting to put whatever is in there into the Projects
table, and the text is not the key. There is no Secondary Data Source
involved.

The DropDown is serving two functions ... the actual Display Names displayed
in the DropDownList, which come from the Secondary Data Source ... and then
the mapping of a different field into the Projects table, or the key. For
sake of this discussion, say it's an integer. From the Project table point
of view, it gets the value of the textbox, or the mapped value from the
dropdown list, but in either case, it's an integer. And ... the integer has
no real bearing on the Secondary Data Source. (I know it can be argued that
the DropDown is limiting what integers can go in there, but it's essentially
the same as only typing valid integers in there)

The contents of the list itself is the destination of the Secondary Data
Source. And the dropdown "Knows" to use the display name for the list, but
the value for the table.

Bob
 
L

Laurie_Marsh

I do have managed C# code behind the form but still couldn't get anything to
work. So, here is what I did as kind of a kludge:

Use a drop-down list on the form.
Disable the drop-down list at all times.
Make it take up 110% of the column so that the drop-down button actually
gets hidden from the user.
In the next column have a button that is the down arrow character.
Together the two columns look like a drop-down list and when the button is
pressed, my managed code displays my own drop-down list with the appropriate
choices in a wide widget.

Thanks for the information. It will help me to understand things like this
more. Every new feature is yet another adventure in learning:)
 

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