Lookup Fields - Displaying as read only on an edit form showing ID and not TITLE - InfoPath Dev
in

InfoPath Dev

Use our Google Custom Search for best site search results.

Lookup Fields - Displaying as read only on an edit form showing ID and not TITLE

Last post 05-16-2016 04:59 AM by Jimmy. 8 replies.
Page 1 of 1 (9 items)
Sort Posts: Previous Next
  • 07-23-2013 04:43 AM

    Lookup Fields - Displaying as read only on an edit form showing ID and not TITLE

    Hi all,

    I'm almost done with a SharePoint List Form I'm creating.  I have two views on a form, the NEW item view shows a bunch of LOOKUP fields that update their values via a secondary data connection.  All is well there now and that form works great (thanks to Jimmy in another thread).  Anyway I realise that you have to store the value of a LOOKUP field as ID and not TITLE because it expects the data to be an positive integer but will display the actual title in the form and indeed the List View.

    My problem comes when I want to create an "Edit" form which shows the fields already input by the first user as "read-only".  I usually do this by simply switching the Control Type to a calculated field therefore making that field in the form appear as read only and not allow editing.  When I do this on my form the values are showing as the ID value (of course) and not the actual value I want to show.  I've searched around and can't seem to work out exactly what I need to change in the XPATH to make it work.

    Do any of you have any guidance for me on this?

    My LOOKUP Value Settings: Data Source: Party Table  |  Entries: /dfs:myFields/dfs:dataFields/d:SharePointListItem_RW  |  Value: d:ID  |  Display name: d:Title
    My Calculated Value XPATH: dfs:dataFields/my:SharePointListItem_RW/my:Party_x0020_Name

    Thank you for taking the time to read this regardless,
    Steve....

    Ask not what your company SharePoint can do for you, but what you can do for your company SharePoint...
  • 07-25-2013 04:45 AM In reply to

    Re: Lookup Fields - Displaying as read only on an edit form showing ID and not TITLE

    It looks like nobody has any ideas so far and this remains a thorn in my side.  I'll take a good look around and post back if I find the answer in case it helps anyone else in the future.

    Steve...

    Ask not what your company SharePoint can do for you, but what you can do for your company SharePoint...
  • 07-27-2013 10:08 PM In reply to

    Re: Lookup Fields - Displaying as read only on an edit form showing ID and not TITLE

    Hi Steve,

    To show the display value in a calculated value, just insert the field from the secondary data source and click Filter and specify the ID from the main data source.

    Easy as pie,

    Patrick Halstead
    Project Manager at Qdabra
  • 07-29-2013 02:09 AM In reply to

    Re: Lookup Fields - Displaying as read only on an edit form showing ID and not TITLE

    Hey Patrick,

    I get some error when I try to do that saying I can't bind a non repeating control to a repeating table.

    It wants me to make it repeating but because my form is only going to return single records I don't want a repeating table I just want a field.  I am also worried by using the filtering idea you specified above I might run into performance issues again as I've just had to overcome these using the Query fields before running my data connections as it was taking up to 4 minutes to run the filters when it was bringing back the full tables first.

    I'm considering adding some new fields that I can just hide away and using them to run rules on open of the form.  Then I could just set the ID field of the Lookup field as a Query field, run the data connection and populate the fields as I do on the main view of the form when a new records being created.

    Either that or make a rule that populates each of these new fields when the record is created in the first place.

    It's not ideal to create a blank single line of text field just to use for displaying this stuff as read only - but I see no other easy way.  I might be missing something though as admittedly I am still feeling around in the dark a little bit with InfoPath...  Feel free to tell me if I'm missing something simple!

    Ask not what your company SharePoint can do for you, but what you can do for your company SharePoint...
  • 07-31-2013 06:23 AM In reply to

    Re: Lookup Fields - Displaying as read only on an edit form showing ID and not TITLE

    Hi!

    My resolution for this ended up being me creating some single line of text fields (that I didn't display on my form but were in the list) and then applying a rule that set their value to whatever was picked in the lookup list.

    I'm sure it's not the most perfect way to do it but it didn't cause me great stress to have these text fields in the background and it made displaying them as read only in my other view really easy.  It's a shame there's not more options from Microsoft when it comes to Lookup fields in InfoPath 2010.  Hey-Ho though, it works as I need it to and is happily ready for testing now.

    Steve....

    Ask not what your company SharePoint can do for you, but what you can do for your company SharePoint...
  • 08-01-2013 08:38 PM In reply to

    Re: Lookup Fields - Displaying as read only on an edit form showing ID and not TITLE

    Glad you found a fix. Sorry for the delay in responding. You could have right clicked on the data source and chose More and Calculated Value. That might have averted the error you got. Don't know though without looking at your form more closely.

    Patrick Halstead
    Project Manager at Qdabra
  • 08-02-2013 01:23 AM In reply to

    Re: Lookup Fields - Displaying as read only on an edit form showing ID and not TITLE

    No problem Patrick, I appreciate your advice and help.  I'll keep that in mind if I do this sort of thing again.

    I'm really happy with my form now, it's working great and doing exactly what I need really quickly and smooth.  I've learned a lot doing this project.

    Ask not what your company SharePoint can do for you, but what you can do for your company SharePoint...
  • 05-15-2016 10:10 PM In reply to

    • Lizmcc
    • Not Ranked
    • Joined on 04-15-2016
    • Posts 4

    Re: Lookup Fields - Displaying as read only on an edit form showing ID and not TITLE

    Patrick Halstead:

    Glad you found a fix. Sorry for the delay in responding. You could have right clicked on the data source and chose More and Calculated Value. That might have averted the error you got. Don't know though without looking at your form more closely.

     

     

    Hi Patrick,

    Talk about dredging up an old one!

    This solution works except how do I restrict the repeating section to show the filtered result (1 record)? I am getting all records - and the one matching one has a value in it.

    Many thanks! 

  • 05-16-2016 04:59 AM In reply to

    Re: Lookup Fields - Displaying as read only on an edit form showing ID and not TITLE

     Hi Lizmcc

    If your repeating table is showing a large number of rows, this probably means that you are querying the entire list, and this will be bad for performance.

    What you should try instead is to filter your query. That is, before querying the list's data connection, set the appropriate query field to the value that you want to query (e.g. set the ID query field to the lookup value you want), and then query the connection. 

    Could you give that a try? 

    Jimmy Rishe / Software Developer / Microsoft MVP
    Qdabra Software
Page 1 of 1 (9 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.