SharePoint List form look up values - InfoPath Dev Sign in | Join | Help in General InfoPath (Entire Site) InfoPath Dev InfoPath Dev is dedicated to bringing you the information and tools you need to be successful in your Microsoft Office InfoPath development projects. Home Blogs Forums Photos Downloads InfoPath Dev » InfoPath » General » SharePoint List form look up values SharePoint List form look up values Last post 09-22-2013 01:47 PM by Ratamahata. 12 replies. Page 1 of 1 (13 items) Sort Posts: Oldest to newest Newest to oldest Previous Next 07-16-2012 06:36 AM sammyg83 Joined on 05-17-2012 Cumbria Posts 13 SharePoint List form look up values Reply Contact Hello I am looking for some advice on the best way to do my task, so here's a bit about what I'm trying to do: I have a 'Daily Work' SharePoint list with the following columns and I am trying to edit the form in Infopath: ID | Staff No | Date | Job Type | Hours 'Staff No' field is already set to lookup values from an existing SharePoint list: 'Staff List', and as part of this look up you can select a number of tickboxes from the list to display other lookup values which is great! However, I cannot show this value in the infopath form because the record hasn't yet been created and it is therefore not a value yet. So, what I want to do: When the user opens the infopath form to enter their times for the day, by them selecting their staff no, I would like some other fields from the staff list to be displayed on the form in read only (but not necessarily be saved, because I can view these anyway from the lookup value column. This is purely a check for the user to ensure they have entered the correct Staff No). Please could you suggest what the best way would be to do this? I'm a relatively new user so I may have missed something extremely simply! Many thanks for your time. Sammy. Filed under: infopath, SharePoint List, display lookup, read only look up, customise form using infopath 07-16-2012 04:58 PM In reply to Hilary Stoupa Joined on 06-20-2008 Posts 13,297 Re: SharePoint List form look up values Mark as Not AnswerMark as Answer... Reply Contact Hi - What version of InfoPath and SharePoint? If 2010, there are now query fields for SharePoint list connections that could make this really easy. Basically, all you'd have to do is: Create a data connection to your Staff List - don't automatically return the data on load Add a rule to the field where the user selects or enters their staff number that sets the query field in the data connection set up in step one Add another rule to the field where the user selects or enters their staff number that executes the query on the Staff List This should return just information about that person to the data connection for the Staff List - you can then add data fields from that data connection onto your form - the user can't save changes to that data, it will just be for display (you may want to make the controls read only). You would also want to add the same basic logic in the form load event, if the field for the Staff Number isn't blank. That way, if I open an existing Daily Work Item, my data from the Staff List would display. Hope that helps, let me know if I've not included enough detail. Hilary Stoupa 07-17-2012 01:31 AM In reply to sammyg83 Joined on 05-17-2012 Cumbria Posts 13 Re: SharePoint List form look up values Mark as Not AnswerMark as Answer... Reply Contact Hi Hilary Thank you for the reply. Yes I'm fortunate to have Infopath 2010 and I'm using Office 365's SharePoint services. I think I understand, but could you expand a little on item 3? Here are the steps I've taken so far with the rules: 2. Rule 1: Condition: None- runs when the field changes, Rule Type: Action, Run these actions:* Query using a data connection: STAFF (the connection I created before) 3. Rule 2: Condition: None- runs when the field changes, Rule Type: Action, Run these actions:* Set a field's value: Name = Title (Name being the field on my infopath form, and title being the field selected from STAFF (in advanced view (secondary)) Rule 1 appears to work fine, but I'm missing something from the 2nd. Could you help? Thanks again Sammy. 07-17-2012 07:47 AM In reply to Hilary Stoupa Joined on 06-20-2008 Posts 13,297 Re: SharePoint List form look up values Mark as Not AnswerMark as Answer... Reply Contact What I'm suggesting is that you only return the data from the staff list for the staff number entered by the user. If you expand the query fields for your Staff data connection in the data source task pane (if this is a SharePoint List form you'll have to select the advanced view in the task pane) you'll have one that corresponds with the staff number, right? You can set that query field to the form field where the user enters her staff number and then execute the query - this may be easier to show than it is explain, so if you attach your template under the "Options" tab, I can set it up in your form the way I think it needs to be.... Hilary Stoupa 07-17-2012 08:46 AM In reply to sammyg83 Joined on 05-17-2012 Cumbria Posts 13 Re: SharePoint List form look up values Template STAFF.xsn Mark as Not AnswerMark as Answer... Reply Contact I'm trying to understand and it's probably really simple, but I've come stuck! Many thanks for the offer to look at my template, hopefully then you can see where I'm slipping up. In previous forms I've managed to create cascading drop down lists, and as you'll know it's a similar concept, only this time I'm referencing/looking up an exact record rather than a list of records. 07-17-2012 09:51 AM In reply to Hilary Stoupa Joined on 06-20-2008 Posts 13,297 Re: SharePoint List form look up values Template STAFF.xsn Mark as Not AnswerMark as Answer... Reply Contact Save this locally then right click and select design - I added notes to the form itself. Hilary Stoupa 07-18-2012 07:56 AM In reply to sammyg83 Joined on 05-17-2012 Cumbria Posts 13 Re: SharePoint List form look up values Mark as Not AnswerMark as Answer... Reply Contact This is fabulous - thank you so much for your help. I have just one more question if I may... The location field is set to lookup the value in a column on my SharePoint 'Staff' list. This column itself is a lookup value from locations. And this form appears to be displaying the ID from that table rather than the text what is actually in the column. I find this weird as I haven't even got a data connection set up to list 'Locations'. Any ideas why or how to fix? Thanks again for your help. Sammy. 07-18-2012 08:13 AM In reply to Hilary Stoupa Joined on 06-20-2008 Posts 13,297 Re: SharePoint List form look up values Mark as Not AnswerMark as Answer... Reply Contact Well, a lookup column is going to always have the ID of the "looked up" item. If you look at the Data Connections dialog (Data tab on ribbon, click the Data Connections button) you'll see a number of data connections that say in the Details section (just click on the name of a data connection and there will be details about it in the bottom of the dialog, no need to Modify): Note: This data connection is used for a lookup field in this form. To remove this data connection, delete the lookup field. So, looks like ShP / IP add these for you. Hilary Stoupa 02-06-2013 01:25 AM In reply to poppyq Joined on 09-13-2012 Posts 14 Re: SharePoint List form look up values Mark as Not AnswerMark as Answer... Reply Contact Hilary, Once setting the query field, then querying the data connection, is it necessary to set the query field back to blank just in case you're going to query that data again with perhaps another query field used as the filter? I'm pretty sure the answer here is yes, but I just want someone else to confirm it for me. 02-06-2013 07:26 AM In reply to Hilary Stoupa Joined on 06-20-2008 Posts 13,297 Re: SharePoint List form look up values Mark as Not AnswerMark as Answer... Reply Contact Oh, I would. Better safe then perplexed later. :) Hilary Stoupa 09-20-2013 09:03 AM In reply to Ratamahata Joined on 09-20-2013 Posts 2 Re: SharePoint List form look up values Mark as Not AnswerMark as Answer... Reply Contact Hello Hillary Nice solution. I'm facing a similar problem. Now, when I check on the field properties, on the query field I see different options than the data field.Specifically, I'm trying to query a value, from a multiple lines of text column, which is shown on data field, but not on the query field.What alternatives do you see here, so I can show the value on the form before (client side), before the value is actually set on the field? (pretty much like you can do with CAML , JScript & JQuery) Thanks in advance, R. Filed under: CAML, SharePoint 2010, 2010, Info Path 2010, Sharepoint 2010 infopath 2010, Infopath 2010 lookup, 2010 InfoPath, query, Infopath 2010 rules 09-20-2013 03:07 PM In reply to Hilary Stoupa Joined on 06-20-2008 Posts 13,297 Re: SharePoint List form look up values Mark as Not AnswerMark as Answer... Reply Contact Sorry - I don't understand the question. Query fields are used to set a filter on the data returned to the form (i.e. - "Give me all Customers with LastName = Smith" if you set the LastName query field of the Customer's data source in your form to Smith). I would not expect the values of the query fields to match the data fields. Hilary Stoupa 09-22-2013 01:47 PM In reply to Ratamahata Joined on 09-20-2013 Posts 2 Re: SharePoint List form look up values Mark as Not AnswerMark as Answer... Reply Contact Hello HilaryThanks for your quick response. I have different fields, for cascading lookups on my InfoPath form querying data from an auxiliary list, so I filter by each lookup and the result is a unique value (which in turn is a multi-line text box in the source list).So the user, select each field, and a value is returned. The point is that this value is not set on the destination field until saving/submitting the form.If the users open the form after the data has been saved, then the value has been submitted to the destination list and then is presented on the form.So the challenge is to present the value (rich text) on the form, before saving, so the user can make sure it is selecting the right option.When you do and aspx form, and use jquery and caml, you can query values, which are presented on the form before actually saving the form. I'm not sure you can do the same with InfoPath. As per your initial response, I understood you could achieve this using query fields (instead of data fields). Am I getting this right?If the answer is yes, then when selecting the data connection, and opting for data fields or query fields, fields available are not the same (not sure the reason for this), since the field I need to present the data on the form is available on the Data Fields, but not the Query Fields (Since the multi-lines, rich text field is not suited for some sort of queries, I' wondering my options to turn that multiple-lines-of-text field into another one, like single-line-of-text) Thanks in advance for your help.Regards,R. Page 1 of 1 (13 items) Copyright © 2003-2019 Qdabra Software. All rights reserved.View our Terms of Use.
Hello
I am looking for some advice on the best way to do my task, so here's a bit about what I'm trying to do:
I have a 'Daily Work' SharePoint list with the following columns and I am trying to edit the form in Infopath:
ID | Staff No | Date | Job Type | Hours
'Staff No' field is already set to lookup values from an existing SharePoint list: 'Staff List', and as part of this look up you can select a number of tickboxes from the list to display other lookup values which is great! However, I cannot show this value in the infopath form because the record hasn't yet been created and it is therefore not a value yet.
So, what I want to do: When the user opens the infopath form to enter their times for the day, by them selecting their staff no, I would like some other fields from the staff list to be displayed on the form in read only (but not necessarily be saved, because I can view these anyway from the lookup value column. This is purely a check for the user to ensure they have entered the correct Staff No).
Please could you suggest what the best way would be to do this? I'm a relatively new user so I may have missed something extremely simply!
Many thanks for your time.
Sammy.
Hi - What version of InfoPath and SharePoint? If 2010, there are now query fields for SharePoint list connections that could make this really easy. Basically, all you'd have to do is:
This should return just information about that person to the data connection for the Staff List - you can then add data fields from that data connection onto your form - the user can't save changes to that data, it will just be for display (you may want to make the controls read only).
You would also want to add the same basic logic in the form load event, if the field for the Staff Number isn't blank. That way, if I open an existing Daily Work Item, my data from the Staff List would display.
Hope that helps, let me know if I've not included enough detail.
Hi Hilary
Thank you for the reply. Yes I'm fortunate to have Infopath 2010 and I'm using Office 365's SharePoint services.
I think I understand, but could you expand a little on item 3?
Here are the steps I've taken so far with the rules:
2. Rule 1: Condition: None- runs when the field changes, Rule Type: Action, Run these actions:* Query using a data connection: STAFF (the connection I created before)
3. Rule 2: Condition: None- runs when the field changes, Rule Type: Action, Run these actions:* Set a field's value: Name = Title (Name being the field on my infopath form, and title being the field selected from STAFF (in advanced view (secondary))
Rule 1 appears to work fine, but I'm missing something from the 2nd.
Could you help?
Thanks again
What I'm suggesting is that you only return the data from the staff list for the staff number entered by the user.
If you expand the query fields for your Staff data connection in the data source task pane (if this is a SharePoint List form you'll have to select the advanced view in the task pane) you'll have one that corresponds with the staff number, right?
You can set that query field to the form field where the user enters her staff number and then execute the query - this may be easier to show than it is explain, so if you attach your template under the "Options" tab, I can set it up in your form the way I think it needs to be....
I'm trying to understand and it's probably really simple, but I've come stuck!
Many thanks for the offer to look at my template, hopefully then you can see where I'm slipping up.
In previous forms I've managed to create cascading drop down lists, and as you'll know it's a similar concept, only this time I'm referencing/looking up an exact record rather than a list of records.
Save this locally then right click and select design - I added notes to the form itself.
This is fabulous - thank you so much for your help.
I have just one more question if I may...
The location field is set to lookup the value in a column on my SharePoint 'Staff' list. This column itself is a lookup value from locations. And this form appears to be displaying the ID from that table rather than the text what is actually in the column.
I find this weird as I haven't even got a data connection set up to list 'Locations'. Any ideas why or how to fix?
Thanks again for your help.
Well, a lookup column is going to always have the ID of the "looked up" item. If you look at the Data Connections dialog (Data tab on ribbon, click the Data Connections button) you'll see a number of data connections that say in the Details section (just click on the name of a data connection and there will be details about it in the bottom of the dialog, no need to Modify):
Note: This data connection is used for a lookup field in this form. To remove this data connection, delete the lookup field.
So, looks like ShP / IP add these for you.
Hello Hillary
Nice solution. I'm facing a similar problem.
Now, when I check on the field properties, on the query field I see different options than the data field.Specifically, I'm trying to query a value, from a multiple lines of text column, which is shown on data field, but not on the query field.What alternatives do you see here, so I can show the value on the form before (client side), before the value is actually set on the field? (pretty much like you can do with CAML , JScript & JQuery)
Thanks in advance,
R.
Sorry - I don't understand the question. Query fields are used to set a filter on the data returned to the form (i.e. - "Give me all Customers with LastName = Smith" if you set the LastName query field of the Customer's data source in your form to Smith). I would not expect the values of the query fields to match the data fields.
Hello HilaryThanks for your quick response.
I have different fields, for cascading lookups on my InfoPath form querying data from an auxiliary list, so I filter by each lookup and the result is a unique value (which in turn is a multi-line text box in the source list).So the user, select each field, and a value is returned. The point is that this value is not set on the destination field until saving/submitting the form.If the users open the form after the data has been saved, then the value has been submitted to the destination list and then is presented on the form.
So the challenge is to present the value (rich text) on the form, before saving, so the user can make sure it is selecting the right option.
When you do and aspx form, and use jquery and caml, you can query values, which are presented on the form before actually saving the form. I'm not sure you can do the same with InfoPath. As per your initial response, I understood you could achieve this using query fields (instead of data fields). Am I getting this right?If the answer is yes, then when selecting the data connection, and opting for data fields or query fields, fields available are not the same (not sure the reason for this), since the field I need to present the data on the form is available on the Data Fields, but not the Query Fields
(Since the multi-lines, rich text field is not suited for some sort of queries, I' wondering my options to turn that multiple-lines-of-text field into another one, like single-line-of-text)
Thanks in advance for your help.
Regards,R.