DropDown Box Values - Displaying Two Fields From Lookup List

Hi,

I have a list which contains a lookup value to another list.  In the form design, I would like the dropdown box which selects the lookup value to contain both the value and another column from the list.

The reason being is that the value should be an ID number but because the ID alone is not very useful, I want to display both the ID and the Title field.

Example:

My lookup list contains..

ID Title Description
1 Homer Father
2 Bart Son
3 Marge Mother

When composing my form for the main list I want to lookup and store the ID from my lookup list but I want the dropdown box to show:

1 - Homer
2 - Bart
3 - Marge

By default the dropdown shows:

1
2
3

I hope this makes sense?!

Thanks in advance for any help you can provide.

David

May 19th, 2015 10:01am

The easy option is to leave the drop down as it is, then show a dynamically updated value next to it as the corresponding item. Getting them to both appear in the same drop down box is a bit more tricky, i can't think of a way to do that with Infopath.

In this case you'd go with the title as the drop down option and then display the matching ID value next to it.

Free Windows Admin Tool Kit Click here and download it now
May 19th, 2015 11:05am

Thanks Alex,  I suspected as much!

I managed a workaround...

I created a calculated column on the lookup list which would combine the ID and the Title.  

E.g. formula:
=[ID] & "-" & [Title]

I then created a new datasource in InfoPath for the dropdown box which connects to the lookup list and brings back the ID and the new calculated column.

Then I changed the dropdown box on the form to use the new datasource, specifiying the "value" field as the ID and the "display name" as the calculated column.

Seemed quite a long way round but it does exactly what I needed so now I can move on!

Thanks for taking the time to answer.

David

  • Marked as answer by DcSearle 9 hours 11 minutes ago
May 19th, 2015 6:31pm

Beat me to do it, but a calculated field is the best option for combining them.

Now I'll tell you this, a calculated field pulling an ID column and combing it with some other value can cause issues. When an object is first created, the server has no given it an ID yet -- or it doesn't display immediately, anyway. You may also notice latency after editing an item. So if you had ="Warehouse " & "-" & (ID) and edited the item, the calculated field would display as "Warehouse -" for some time.

The only way to rectify this problem (that I've seen) is to use a counter column and set the value in the list from a workflow.

All the best.

Free Windows Admin Tool Kit Click here and download it now
May 19th, 2015 9:23pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics