web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Getting a syntax error...
Power Apps
Answered

Getting a syntax error when trying to search through Sharepoint list

(0) ShareShare
ReportReport
Posted on by 27

Hi there,

 

So I have a SharePoint list called 'Access_Control' which consists of an email and three other fields (TECL, EIECL, Satellite_ECL) as you can see below

 

Dummy ECL.PNG

 

I then have a drop-down list which stores the current drop-down option in a variable called ECL_Option.

Finally I have a gallery. I want the gallery's visibility to depend on the drop-down list option and the Access_Control database. If the drop-down option is Transpower, the User's email is in the database and TECL is true then the gallery should be visible otherwise the gallery shouldn't be visible.

 

My code so far is as follows:
If(ECL_Option="Transpower",
ForAll(Access_Control,
If(Title=User().Email, If( TECL="Yes", true, false)), false))

 

Here is a photo of the Power Apps screen I am working on:

 

Screen.PNG

I just am really struggling with the syntax of this language constantly maybe it is because I am use to object-orientated programming. As well as answering this question if anyone has any possible resources to learn the syntax better and kind of linking/nesting things together smoothly that'd be great. Cheers!

Categories:
  • Verified answer
    WarrenBelz Profile Picture
    156,942 Most Valuable Professional on at

    Hi @Xpholio ,

    I will give you what I think is the solution and then explain it

    ECL_Option="Transpower" &&
    Countrows(
     Filter(
     Access_Control,
     Title=User().Email &&
     TECL
     )
    )>0

    Firstly for a Boolean Variable such as Visible, you simply make a statement that can only be true or false and that that translates directly into the Visible property. Secondly, I am assuming that TCL is also a Yes/No field (which is actually true/false - if not use TCL="Yes" in the above.

    So the statement says 

    • IF ECL_Option is Transpower AND
    • in the Access_Control list, IF there are any records with
      • BOTH Title equalling the user's email AND
      • TECL being true,
    • then make the control Visible.

    Please click Accept as solution 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 Thumbs Up.

     

  • WarrenBelz Profile Picture
    156,942 Most Valuable Professional on at

    Hi @Xpholio ,

    Just checking if you got the result you were looking for on this thread. Happy to help further if not.

    Please click Accept as solution 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 Thumbs Up.

  • Xpholio Profile Picture
    27 on at

    Awesome yes it works perfectly. Thank you for providing an explanation too

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 243 Super User 2026 Season 2

#2
WarrenBelz Profile Picture

WarrenBelz 190 Most Valuable Professional

#3
Mohsin Ali Profile Picture

Mohsin Ali 135

Last 30 days Overall leaderboard