cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Helper I
Helper I

search value in sharepoint list not working

hi

i made a search interface like that

InkedCattura_LI.jpg

 the formula when i click on the "cerca" button is

 

 

If(CountRows(Filter(Candidati;StartsWith(NomeCognome;TBNomecognome.Text);ComuneID = Value(LBComuneID.Text))) > 0;Set(Ricerca;"Presente");Set(Ricerca;"Non presente"))

 

 

 as you can see in the image below

Cattura.PNG

 "ricerca" is a variable and the text of the invisible label that you can see in the first image with the text "presente" is set on the value of that variable.

so when i search a person using the textbox "nome e cognome", if it is present in the sharepoint list the label returns "presente", if not returns "non presente" (the "NomeCognome" field is a calculated field in which i concatenate first and last name with a space)

 

now, some results are ok, some others not...if i write the name of some persons i know are in the list the result is "not present", i can't figure it out

 

ps the part of formula "comuneID = Value(LBComuneID.text)" i think is ok, when i select the city with the combobox it just update an invisible label to the ID value of the city chosen (comune means city)

 

help 

2 ACCEPTED SOLUTIONS

Accepted Solutions
Highlighted
Power Apps
Power Apps

Re: search value in sharepoint list not working

Hi @diegomarino ,

I see some yellow warning icons on those controls. Can you hover over those errors and type out the error you're seeing? I am thinking you are experiencing some issues with delegation. CountRows() is not a function that is delegable on SharePoint. You could try a few things here.

 

  • You can evaluate Value(LBComuneID.Text)) ahead of the Filter.
  • You can evaluate the Filter before before getting a count.

 

If(
    With(
        {
            valueComuneID: Value(LBComuneID.Text)
        };
        With(
            {
                table: 
                Filter(Candidati;
                    StartsWith(NomeCognome;TBNomecognome.Text);
                    ComuneID = valueComuneID
                )
            };
            CountRows(table) > 0
        )
    );;
    
    Set(Ricerca;"Presente");;
    Set(Ricerca;"Non presente")
)

 

This means, "Convert LBComuneID to a value. Use that value to filter Candidati. Count the resulting items from the table and if it exceeds 0, run the actions."

 

Let me know if that worked.

View solution in original post

Highlighted
Helper I
Helper I

Re: search value in sharepoint list not working

hi thank you

 

i used this formula

 

If(
    With(
        {valueComuneID: Value(LBComuneID.Text)};
        With(
            {
                table: Filter(
                    Candidati;
                    StartsWith(
                        NomeCognome;
                        TBNomecognome.Text
                    );
                    ComuneID = valueComuneID
                )
            };
            CountRows(table) > 0
        )
    );
    Set(
        Ricerca;
        "Presente"
    );
    Set(
        Ricerca;
        "Non presente"
    )
)

 

i had to delete two ";", i looked for a value i know is in the list but it gave me "not present"...

View solution in original post

2 REPLIES 2
Highlighted
Power Apps
Power Apps

Re: search value in sharepoint list not working

Hi @diegomarino ,

I see some yellow warning icons on those controls. Can you hover over those errors and type out the error you're seeing? I am thinking you are experiencing some issues with delegation. CountRows() is not a function that is delegable on SharePoint. You could try a few things here.

 

  • You can evaluate Value(LBComuneID.Text)) ahead of the Filter.
  • You can evaluate the Filter before before getting a count.

 

If(
    With(
        {
            valueComuneID: Value(LBComuneID.Text)
        };
        With(
            {
                table: 
                Filter(Candidati;
                    StartsWith(NomeCognome;TBNomecognome.Text);
                    ComuneID = valueComuneID
                )
            };
            CountRows(table) > 0
        )
    );;
    
    Set(Ricerca;"Presente");;
    Set(Ricerca;"Non presente")
)

 

This means, "Convert LBComuneID to a value. Use that value to filter Candidati. Count the resulting items from the table and if it exceeds 0, run the actions."

 

Let me know if that worked.

View solution in original post

Highlighted
Helper I
Helper I

Re: search value in sharepoint list not working

hi thank you

 

i used this formula

 

If(
    With(
        {valueComuneID: Value(LBComuneID.Text)};
        With(
            {
                table: Filter(
                    Candidati;
                    StartsWith(
                        NomeCognome;
                        TBNomecognome.Text
                    );
                    ComuneID = valueComuneID
                )
            };
            CountRows(table) > 0
        )
    );
    Set(
        Ricerca;
        "Presente"
    );
    Set(
        Ricerca;
        "Non presente"
    )
)

 

i had to delete two ";", i looked for a value i know is in the list but it gave me "not present"...

View solution in original post

Helpful resources

Announcements
secondImage

New Return to Workplace

Reopen responsibly, monitor intelligently, and protect continuously with solutions for a safer work environment.

Experience what’s next for Power Apps

Join us for an in-depth look at the new Power Apps features and capabilities at the free Microsoft Business Applications Launch Event.

Check this Out

Helpful information

Featuring samples like Return to the Workplace and Emergency Response Applications

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (9,236)