cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

If Statement - Peninput true then send email.

Hello,

 

I have:

If(PenInput_RepSignature.Image=true,Office365.SendEmail("bill.pollock@gea.com","Signature representative","Body Text",{Attachments:Table({Name:"peninput.jpg",ContentBytes:PenInput_RepSignature.Image,'@odata.type':""})}),)

 

This gives an inconpatible type:

Left value is an image - right value is Boleen.type

 

Is there a simple way to check if the peninput is true and then email if not then dont.

What should I use in the formula to do so - is usding an "If" acceptable?

Ta

1 ACCEPTED SOLUTION

Accepted Solutions
RandyHayes
Super User
Super User

@Anonymousthere is not anything that can give you that logic.  You are definitely trying to compare different types in your If statement - in this case a string and a boolean.

 

So, here is an option.  You can set a variable onVisible to get the current image.  Here is an example:

   Set(startImg, Value(Last(Split(PenInput1.Image, "/")).Result))

 

Your If Statement would then be something like this:

   If(!(Value(Last(Split(PenInput1.Image, "/")).Result) = startImg),

        Office365.SendEmail("bill.pollock@gea.com","Signature representative","Body Text",{Attachments:Table ({Name:"peninput.jpg",ContentBytes,PenInput_RepSignature.Image,'@odata.type':""})}),)

 

Note that I was aiming to get the last increment of the image number (assign the Image property to a label text and you will see what I mean).  Probably could have just done an apples to apples comparison (get the image in a variable and compare to current).

 

This does present a problem if the user clears the input as there is no way to intercept that.  However, you could be crafty and put a similar looking icon/image right over that "clear screen" control and in it put the logic to Reset(PenInputControl) and then Set your variable to the new image.

 

Hope this provides a workaround.

 

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

View solution in original post

3 REPLIES 3
RandyHayes
Super User
Super User

@Anonymousthere is not anything that can give you that logic.  You are definitely trying to compare different types in your If statement - in this case a string and a boolean.

 

So, here is an option.  You can set a variable onVisible to get the current image.  Here is an example:

   Set(startImg, Value(Last(Split(PenInput1.Image, "/")).Result))

 

Your If Statement would then be something like this:

   If(!(Value(Last(Split(PenInput1.Image, "/")).Result) = startImg),

        Office365.SendEmail("bill.pollock@gea.com","Signature representative","Body Text",{Attachments:Table ({Name:"peninput.jpg",ContentBytes,PenInput_RepSignature.Image,'@odata.type':""})}),)

 

Note that I was aiming to get the last increment of the image number (assign the Image property to a label text and you will see what I mean).  Probably could have just done an apples to apples comparison (get the image in a variable and compare to current).

 

This does present a problem if the user clears the input as there is no way to intercept that.  However, you could be crafty and put a similar looking icon/image right over that "clear screen" control and in it put the logic to Reset(PenInputControl) and then Set your variable to the new image.

 

Hope this provides a workaround.

 

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

Actually...couldn't resist - had to try it out.  Works perfectly.

See image.  Using that logic from the last post and putting X icons over the existing X control icon in the pen input control, I was able to pull it off.

In first control, it is empty and the same as on visible (has pen marking = false)

In second control...well, has pen marking and result is true

In third, user has clicked the X to clear the control - pen marking = false

Of course this doesn't work if the user draws and then erases by hand. But it gets you closer.

wapfunz1.png

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!
Anonymous
Not applicable

Yahooooooooooooooooooooooooooooooooooooooooooooooooooooooooo!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

Fantastic - works well - I am Happy, oh so happy.

Helpful resources

Announcements
PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

PWREduCon768x460.png

Join us at PWR EduCon - A Power Platform Conference

Learn from the top Power BI, Power Apps, Power Automate & Power Virtual Agents experts!

Top Solution Authors
Top Kudoed Authors
Users online (3,221)