cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
diegomarino
Helper III
Helper III

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
Mr-Dang-MSFT
Power Apps
Power Apps

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

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
Mr-Dang-MSFT
Power Apps
Power Apps

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

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
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Top Solution Authors
Top Kudoed Authors
Users online (2,355)