Skip to main content

Notifications

Power Apps - Power Apps Pro Dev & ISV
Suggested answer

Do a search with two ComboBox with data from a Sharepoint

Posted on by 6
Hello, 

I will add picture off the app and the data. You can see on picture 1 (app_view) that I have 2 ComboBox that can have 1 or more value selected. ComboBox1 argument are 'W1', 'W2' and ComboBox3 are id that can be translate to Value if we use NAME.Value. 

The 2 (data) picture is the Data in my sharepoint.
 
I want that if nothing is selected in both ComboBox it show every line of my Table. And if we add selection of ComboBox only the line  where thos informations appear. 

I have two prototype of code to put in the item section of the Gallery here but none of them work :

1 : 
 
If(
    IsBlank(ComboBox1.SelectedItems) && IsBlank(ComboBox3.SelectedItems);
    'APOLLON_2025_BOOKING TS';
    If(
        !IsBlank(ComboBox1.SelectedItems) && !IsBlank(ComboBox3.SelectedItems);
        Filter(
            'APOLLON_2025_BOOKING TS';
            WEEK in ForAll(ComboBox1.SelectedItems; Value) &&
            NAME in ForAll(ComboBox3.SelectedItems; Value)
        );
        If(
            !IsBlank(ComboBox1.SelectedItems);
            Filter(
                'APOLLON_2025_BOOKING TS';
                WEEK in ForAll(ComboBox1.SelectedItems; Value)
            );
            Filter(
                'APOLLON_2025_BOOKING TS';
                NAME in ForAll(ComboBox3.SelectedItems; Value)
            )
        )
    )
)
If(
    IsBlank(ComboBox1.SelectedItems) && IsBlank(ComboBox3.SelectedItems);
    'APOLLON_2025_BOOKING TS',
    If(
        !IsBlank(ComboBox1.SelectedItems) && !IsBlank(ComboBox3.SelectedItems),
        Filter(
            'APOLLON_2025_BOOKING TS',
            WEEK in ForAll(ComboBox1.SelectedItems, Value) &&
            NAME in ForAll(ComboBox3.SelectedItems, Value)
        ),
        If(
            !IsBlank(ComboBox1.SelectedItems),
            Filter(
                'APOLLON_2025_BOOKING TS',
                WEEK in ForAll(ComboBox1.SelectedItems, Value)
            ),
            Filter(
                'APOLLON_2025_BOOKING TS',
                NAME in ForAll(ComboBox3.SelectedItems, Value)
            )
        )
    )
)


2 : 
 
Filter(
    'APOLLON_2025_BOOKING TS';
    (IsBlank(ComboBox1.SelectedItems) || WEEK in ForAll(ComboBox1.SelectedItems; Value)) &&
    (IsBlank(ComboBox3.SelectedItems) || NAME in ForAll(ComboBox3.SelectedItems; Value))
)


I stay available if you need more informations and thanks if you try help me find this solution
  • IS-28111528-0 Profile Picture
    IS-28111528-0 6 on at
    Do a search with two ComboBox with data from a Sharepoint
    Hi @WarrenBelz,
     
    I try your code there is two error of type every time I don't know how to fix them because for ComboBox1.Selected.Value it says it's waiting for a Text Value but a Record is given. See image erreur2.1

    And the secondone is also for type and it's this line :
                WEEK = _Items.Value

    on the equal signes it says that both of them needs to be of the record type I don't really understand this typing please help me if you can I can also Show the data I use if you want. See Image erreur2.2

    Thanks in adavnced.
     
  • WarrenBelz Profile Picture
    WarrenBelz 143,246 on at
    Do a search with two ComboBox with data from a Sharepoint
    If you are not concerned with Delegation
    Filter(
       'APOLLON_2025_BOOKING TS';
       (
          Len(ComboBox1.Selected.Value) = 0 ||
          WEEK in ComboBox1.SelectedItems
       ) &&
       (
          Len(ComboBox3.Selected.Value) = 0 ||
          NAME in ComboBox3.SelectedItems
       )
    )
    If you want some sort of Delegation Management
    If(
       Len(ComboBox1.Selected.Value) = 0  && Len(ComboBox3.Selected.Value) = 0;
       'APOLLON_2025_BOOKING TS';
       With(
          {
             _Data:
             If(
                Len(ComboBox1.Selected.Value) = 0;
                'APOLLON_2025_BOOKING TS';
                Ungroup(
                   ForAll(
                      ComboBox1.SelectedItems As _Items;
                      Filter(
                         'APOLLON_2025_BOOKING TS';
                         WEEK = _Items.Value
                      )
                   );
                   Value
                )
             )
          };
          If(
             Len(ComboBox3.Selected.Value) = 0;
             _Data;
             Ungroup(
                ForAll(
                   ComboBox3.SelectedItems As _Items;
                   Filter(
                      _Data;
                      NAME = _Items.Value
                   )
                );
                Value
             )
          )
       )
    )
     
    Please click Does this answer your question if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it a Like.
    MVP (Business Applications)    Visit my blog Practical Power Apps    Buy me a coffee
  • Suggested answer
    IS-28111528-0 Profile Picture
    IS-28111528-0 6 on at
    Do a search with two ComboBox with data from a Sharepoint
    I have tried your code but no luck there is error that I have find early and I don't realy know how to fix it without changing my data.

    I join to this message the error in Image.


    I can had that I have tree line that work seperatly but I don't find a way to put them all in once : 
     
    'APOLLON_2025_BOOKING TS' // Show all data in the Gallery
     
    Filter('APOLLON_2025_BOOKING TS'; WEEK in ForAll(ComboBox1.SelectedItems; Value)) //ComboBox1 work
    Filter('APOLLON_2025_BOOKING TS'; NAME in ForAll(ComboBox3.SelectedItems; Value)) //ComboBox3 work





    Thanks for all the help
  • jpespena Profile Picture
    jpespena 254 on at
    Do a search with two ComboBox with data from a Sharepoint
    Hi,
     
    Try this:
     
    Filter(
        'APOLLON_2025_BOOKING TS';
        Or(
            IsEmpty(ComboBox1.SelectedItems); 
            WEEK in Concat(
               ComboBox1.SelectedItems; 
               Value;
               ', '
             )
         );
         Or(
            IsEmpty(ComboBox3.SelectedItems); 
            NAME in Concat(
               ComboBox3.SelectedItems; 
               Value;
               ', '
             )
         );
    )

     
  • Suggested answer
    CU29110135-0 Profile Picture
    CU29110135-0 4 on at
    Do a search with two ComboBox with data from a Sharepoint
    .

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

November 2024 Newsletter…

November 2024 Community Newsletter…

Community Update Oct 28…

Power Platform Community Update…

Tuesday Tip #7 Community Profile Tips…

Welcome to a brand new series, Tuesday Tips…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 143,246

#2
RandyHayes Profile Picture

RandyHayes 76,308

#3
Pstork1 Profile Picture

Pstork1 63,884

Leaderboard