cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Advocate IV
Advocate IV

Restrict Dropdown control choices in form if another gallery item contains same choice

Hi All,

 

I'm wondering if it possible to restrict Dropdown control choices in form if another gallery item contains same choice.

 

My scenario is as follows:

There are 5 pertinent dropdown choices linked to a Sharepoint List - Year, Week, Publication, Page, Story Number, in this logical order.

 

The Story Number dropdown contains 5 choices: Story 001 -> Story 005.

 

What I'd like to be able to do is restrict the Story Number choices to prevent users from selecting the same Story Number if other gallery items contain the same Year, Week, Publication, and Page choices.

 

The result would be that users must select a unique Story Number value for the given Page of a Publication for that Week and Year.

 

Is something like this possible?

 

Cheers in advance for any advice.

 

Chris.

 

EDIT: I should add that users will be in Form.Mode New when the restriction should ideally take place, but I could compromise and make it Form.Mode Edit if it was necessary.

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support
Community Support

Hi @cfebvre ,

Could you please share a bit more about your scenario?

Do you want to restrict the Story Number Dropdown to select unique choice if there is already an Gallery item have same Year, Week, Publication, and Page choices?

Further, could you please share a bit more about the formula you typed within the Items property of Story Number Dropdown box? Could you please show more details about your data source?

 

Based on the needs that you mentioned, I think the Filter function could achieve your needs. I assume that your data source is a SP List, and you use corresponding Choice type columns to store the Year, Week, Publication, Page, Story Number Dropdown box.

 

Set the Items property of the Story Number Dropdown to following:

Filter(
       Choices('SP List'.'Story Number'),
       Not(Value in ForAll(
                       Filter('SP List', Year.Value = YearDropdown.Selected.Value, Week.Value = WeekDropdown.Selected.Value, Publication.Value = PublicationDropdown.Selected.Value, Page.Value = PageDropdown.Selected.Value),
                      'Story Number'.Value
                )
       )
)

 

If you use Normal Text Type to store the Year, Week, Publication, Page, Story Number value in your data source, please consider modify your formula as below:

Filter(
       'Type your Story Number Option Choices formula here',
       Not(Value in Filter('SP List', Year = YearDropdown.Selected.Value, Week = WeekDropdown.Selected.Value, Publication = PublicationDropdown.Selected.Value, Page = PageDropdown.Selected.Value).'Story Number',
       )
)

 

Please take a try with the above formula, then check if the issue is solved.

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
Super User
Super User

Here is an example use the CustomGallerySample. In this case, the selected gallery item from Dropdown1 will be filtered out of the gallery whose Items property is set to:

Filter(CustomGallerySample,Dropdown1.Selected.SampleHeading <> SampleHeading)

 You can add more filter logic after the first example shown.

---
If this answered your question, please click "Accept Solution". If this helped, please Thumbs Up.

Community Support
Community Support

Hi @cfebvre ,

Could you please share a bit more about your scenario?

Do you want to restrict the Story Number Dropdown to select unique choice if there is already an Gallery item have same Year, Week, Publication, and Page choices?

Further, could you please share a bit more about the formula you typed within the Items property of Story Number Dropdown box? Could you please show more details about your data source?

 

Based on the needs that you mentioned, I think the Filter function could achieve your needs. I assume that your data source is a SP List, and you use corresponding Choice type columns to store the Year, Week, Publication, Page, Story Number Dropdown box.

 

Set the Items property of the Story Number Dropdown to following:

Filter(
       Choices('SP List'.'Story Number'),
       Not(Value in ForAll(
                       Filter('SP List', Year.Value = YearDropdown.Selected.Value, Week.Value = WeekDropdown.Selected.Value, Publication.Value = PublicationDropdown.Selected.Value, Page.Value = PageDropdown.Selected.Value),
                      'Story Number'.Value
                )
       )
)

 

If you use Normal Text Type to store the Year, Week, Publication, Page, Story Number value in your data source, please consider modify your formula as below:

Filter(
       'Type your Story Number Option Choices formula here',
       Not(Value in Filter('SP List', Year = YearDropdown.Selected.Value, Week = WeekDropdown.Selected.Value, Publication = PublicationDropdown.Selected.Value, Page = PageDropdown.Selected.Value).'Story Number',
       )
)

 

Please take a try with the above formula, then check if the issue is solved.

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

@v-xida-msft Hi Kris,

 

Thanks so much, the first example you gave worked absolutely perfectly!

 

Cheers, Chris

Helpful resources

Announcements
New Badges

New Solution Badges!

Check out our new profile badges recognizing authored solutions!

New Power Super Users

Congratulations!

We are excited to announce the Power Apps Super Users!

Power Apps Community Call

Power Apps Community Call: February

Did you miss the call? Check out the Power Apps Community Call here.

Microsoft Ignite

Microsoft Ignite

Join digitally, March 2–4, 2021 to explore new tech that's ready to implement. Experience the keynote in mixed reality through AltspaceVR!

Top Solution Authors
Top Kudoed Authors
Users online (75,185)