Retrieve multiple fields from Sharepoint list

T

TimS

I have a Sharepoint list with three fields - Location, Business Hours, and
Point of Contact. I have made this list a secondary data source to my
infopath form. My form has a repeating table on it, with three fields -
Location, BusinessHours, and POC. I have removed the default textbox bound
to the Location field from the repeating table, and replaced it with a
dropdown list box, rebinding it to the Location field. Now, what I would
like it to do, is when I pick the desired row in the Location field, for it
to populate the other two fields from the corresponding row (record) in the
Sharepoint list. So if I pick Location 1, it will automatically fill in the
business hours and POC for Location 1. Is this functionality possible
without alot of coding?
 
C

Clay Fox

This is possible through rules and actions.

Add a rule to your drop down that has an action to set each field witht he
value from your datasource. Remember to use a filter so that you set the
values where the location = the location selected in the dropdown.
 
T

TimS

Thanks, Clay. Do I need to apply a filter to this rule, or something? How
it is now behaving is that if I pick Location B, it populates the other two
fields, but with the values corresponding to the Location A record instead of
the Location B record.

Tim
 
C

Clay Fox

Yes I think you need the filter. If you do not use a filter it will take the
first value in the list.

When selecting the field to use as the source (POC from the secondary DC)
there will be a filter button in the lower left of the window.

Add and then select location (in the secondary data source) = location
(value of the field your dropdown is bound to).
 
T

TimS

Thanks, Clay, for your responses. Ok, this is "sort of" working, but not yet
adequately. Two issues:

1. When you're designing a form template for use in a browser, when you try
to apply a filter, you get the following message: "Filtering is not
supported in browser-enabled form templates." I temporarily unchecked the
browser compatibility checkbox, and it looks like I can set up a filter, and
then when I re-enable browser compatibility later, the filter still seems to
be applied. True?

2. If the field to which my dropdown is bound is within a repeating table,
there can be more than one record, so when creating the filter, I need to be
able to specify to filter on the location of THAT record. Can this be done
by manually editing the filter formula (e.g. use
@PointOfContact[@Location = this.ChangeLocation]
or
@PointOfContact[@Location = my:ChangeLocation]
instead of just
@PointOfContact[@Location = ChangeLocation]

(These two syntaxes aren't accepted - is there a correct one that will work?)

Thanks again,

Tim
 
C

Clay Fox

If you rule is within a specific record then you do not need the filter as it
will use the current record. The current() function also might be needed.

I do not believe the filter will work even if design checker does not catch
it. You can try and find out.
--
Clay Fox / Microsoft InfoPath MVP
www.InfoPathDev.com / The InfoPath Authority / Downloads, Samples, How-To,
Experts, Forum


TimS said:
Thanks, Clay, for your responses. Ok, this is "sort of" working, but not yet
adequately. Two issues:

1. When you're designing a form template for use in a browser, when you try
to apply a filter, you get the following message: "Filtering is not
supported in browser-enabled form templates." I temporarily unchecked the
browser compatibility checkbox, and it looks like I can set up a filter, and
then when I re-enable browser compatibility later, the filter still seems to
be applied. True?

2. If the field to which my dropdown is bound is within a repeating table,
there can be more than one record, so when creating the filter, I need to be
able to specify to filter on the location of THAT record. Can this be done
by manually editing the filter formula (e.g. use
@PointOfContact[@Location = this.ChangeLocation]
or
@PointOfContact[@Location = my:ChangeLocation]
instead of just
@PointOfContact[@Location = ChangeLocation]

(These two syntaxes aren't accepted - is there a correct one that will work?)

Thanks again,

Tim


Clay Fox said:
Yes I think you need the filter. If you do not use a filter it will take the
first value in the list.

When selecting the field to use as the source (POC from the secondary DC)
there will be a filter button in the lower left of the window.

Add and then select location (in the secondary data source) = location
(value of the field your dropdown is bound to).
 

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