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

Inconsistent Error Message

Hello,

 

I am hoping for some clarification on an inconsistency I am observing with one of the controls I am working with. I am using the "Add picture" control from the Media drop down which generates two controls; a custom button and an image control. 

 

I am trying to add a condition where it will show an image from one place or another, depending on the result of the condition. In the 'image' field of the image control, it works if I have this:

Reigningfear_0-1610157558775.png

In the statement above, it accepts the text expression (see "data Type").


However, if that same expression is part of the if statement, it doesn't accept it:

Reigningfear_1-1610157625958.png

In the statement above, The filter works fine. The part triggering the error is "AddMediaButton.Media" when you hover over it. Also to be clear, it's the same statement that's commented out in the first image. the error message just blocks the first part.

 

I've observed this behavior on different controls where it accepts something if it's outside a switch/if statement but will not accept it if it's within a switch/if statement.

 

Does anyone know why this happens?

1 ACCEPTED SOLUTION

Accepted Solutions
WarrenBelz
Super User III
Super User III

Hi @Reigningfear ,

Your code still has the end of the If statement on it 

,AddMediaButton.Media)

It needs to stop at Screenshot.

 

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.

View solution in original post

3 REPLIES 3
WarrenBelz
Super User III
Super User III

Hi @Reigningfear ,

Your code still has the end of the If statement on it 

,AddMediaButton.Media)

It needs to stop at Screenshot.

 

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.

View solution in original post

Thank you for your reply @WarrenBelz . I swapped the logic so that the last part of the If statement was the filter expression with the .screenshot and it worked. I would never have thought to swap them because I didn't realize it mattered. Is there anything I can read that would provide these kinds of details about syntax? 

Hi @Reigningfear ,

This is one (of the few) things in Power Apps that follows exactly the same rules as most other programming languages. The Syntax is If(Then,Else) in its simplest form, so when you remove the If, you have to remove the Else and Then becomes the (singular unconditional) statement.

 

 

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

Power Apps Community Call

Monthly Power Apps Community Call

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

secondImage

Experience what’s next for Power Apps

See the latest Power Apps innovations, updates, and demos from the Microsoft Business Applications Launch Event.

Power Platform ISV STudio

Power Platform ISV Studio

ISV Studio is the go-to Power Platform destination for ISV’s to monitor & manage applications post-AppSource publish.

Top Solution Authors
Top Kudoed Authors
Users online (36,791)