cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Nosmoz
Level: Powered On

How to detect if the penInput is blank or empty

Hi, 

 

I want to have a pen input to collect a signature, check if the penInput is empty or blank and doing some flows actions. I try this https://powerusers.microsoft.com/t5/General-Discussion/How-do-you-determine-if-Pen-Input-is-blank/td... from @Shanescows on a form called when you are on a list SharePoint and it's working great! But when i create my application and want to use it, it's not really work. 

 

To understand why i have this problem, i create two inputs to check my values :

- TextInput2 → On the default data, i set my var BlankImage (created on my EditScreen1 on parameter "OnVisible" with

UpdateContext({BlankImage : MyDoodles.Image})

)

 

- TextInput4 → On default data, i set the value MyDoodles.Image.

 

When I run my application, you can see two blobmanager URLs, where blue line is for my TextInput4  and the other for TextInput2 (my PenInput is empty, I haven't written anything on but i have 2 different URLs).

image.png

 

I don't want to let my user use or click on any button, his job is to sign my form, write some information in and valid his form. After my function check if the penInput is empty or not and doing some actions  in terms of the response.

 

Thanks for your help.

 

1 ACCEPTED SOLUTION

Accepted Solutions
h-nagao
Level 10

Re: How to detect if the penInput is blank or empty

How about JSON approach?

I have tested on my side, and it’s working fine.

For OnVisible property:
Reset(PenInput1);
UpdateContext({BlankBlobData: JSON(PenInput1.Image, IncludeBinaryData)})

and some label text:
If(
JSON(PenInput1.Image,IncludeBinaryData) = BlankBlobData,
"Pen Input control is Blank. You do not draw anything within it",
"Pen Input control is not Blank. You have drawn something within...”)
5 REPLIES 5
h-nagao
Level 10

Re: How to detect if the penInput is blank or empty

Hi,

To compair "blank" image and filled image, I have used JSON(PenInput.Image, IncludeBinaryData).

JSON(PenInput.Image, IncludeBinaryData) produces data uri of image and compair default data uri and current one, I could detect PenInput is empty.

*Timer control is monitoring pen input image.

detect_peninput.png

Community Support Team
Community Support Team

Re: How to detect if the penInput is blank or empty

Hi @Nosmoz ,

Do you want to detect if the Pen Input control is empty?

 

Currently, within PowerApps, there is no direct way to detect if a Pen Input control is empty. Even though, you do not draw anything within the Pen Input control (The Pen Input control is Blank), the result the PenInput1.Image formula would still return a blob data (e.g. appres://blobmanager/b8c2a7250f344b148a9a0dfd19e7a6a0/3) rather than empty.

 

Within the solution mentioned by  @Shanescows, it store the PenInput1.Image result into a variable as Blank Pen Input when you load your Pen Input screen first time. If you draw anything within the Pen Input control, the result the PenInput1.Image formula returned would be different from the variable value you set up before.

So you could compare the current PenInput1.Image result with the stored variable, to detect if the Pen Input control is "Blank" (You do not draw anything within the Pen Input control).

 

Please consider set the OnVisible property of the screen which contains the Pen Input control to following:

Reset(PenInput1);
UpdateContext({BlankBlobData: PenInput1.Image})

If you want to detect if the Pen Input control is "Blank" (you do not draw anything within the Pen Input control), please use the following formula:

If(
    PenInput1.Image = BlankBlobData,
    "Pen Input control is Blank. You do not draw anything within it",
    "Pen Input control is not Blank. You have drawn something within it"
)

Please consider take a try with above solution, check if the issue is solved.

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Nosmoz
Level: Powered On

Re: How to detect if the penInput is blank or empty

Hi thanks for your help,

 

I test each of your propositions and not really work as I want Smiley Sad

 

@v-xida-msft, I tested to put my Reset(penInput1) on my screen (EditScreen) after my UpdateContext (just to check and understand how this is work). 

 

When I do this, and I click on my button to have access to my EditScreen, my blob data change 2 times (My UpdateContext return this : appres://blobmanager/b8c2a7250f344b148a9a0dfd19e7a6a0/3 and my penInput1.Image  return this : appres://blobmanager/b8c2a7250f344b148a9a0dfd19e7a6a0/5).

 

So, I think the reset method change the value of your penInput1 (you can see the value input change when you click on the clean/reset button when your showControls is true).

 

I remove all my Reset(penInput1) except the one on the onVisible parameter, but the problem has not gone.

 

 

h-nagao
Level 10

Re: How to detect if the penInput is blank or empty

How about JSON approach?

I have tested on my side, and it’s working fine.

For OnVisible property:
Reset(PenInput1);
UpdateContext({BlankBlobData: JSON(PenInput1.Image, IncludeBinaryData)})

and some label text:
If(
JSON(PenInput1.Image,IncludeBinaryData) = BlankBlobData,
"Pen Input control is Blank. You do not draw anything within it",
"Pen Input control is not Blank. You have drawn something within...”)
Highlighted
Nosmoz
Level: Powered On

Re: How to detect if the penInput is blank or empty

Hi, I was testing with JSON method, modify where I call it (on my iconButton, onSelect), and now, working perfectly.

 

Thanks for your help.

 

 

Helpful resources

Announcements
firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

FirstImage

Power Platform World Tour

Coming to a city near you

thirdimage

PowerApps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

FourthImage

Join PowerApps User Group!!

Connect, share, and learn with your peers year-round

SecondImage

Power Platform Summit North America

Register by September 5 to save $200

Top Kudoed Authors
Users Online
Currently online: 185 members 5,450 guests
Please welcome our newest community members: