cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Frequent Visitor

PenInput Binary to EditForm Field / Clear DataCard After Submit Form

I am working on a system for our gate security team. A secretary puts in the initial appointment information, and then the gate security would use an ipad to check visitor information and have them sign in before entering.

 

Screen Shot 2020-09-11 at 8.39.03 PM.png

 

 

The signature is where I'm having trouble. The pen input works without issue. There's a button using Json to convert to binary.

 

Set(varSig, JSON(Sig.Image, IncludeBinaryData))

 

Then, a hidden text box to make the binary readable by the Image control.

 

Substitute(varSig,Char(34),"")

 

Then a second button to set a variable.

 

Set(Var_Copy,TextInput2.Text)

 

This variable is the default in an EditForm field called "Image".

 

When the form is submitted the binary is saved to a SharePoint list. The image then shows without issue.

 

The problem is the form field on the signature screen will always show the last copied text. If someone accidentally goes to the signature page on a previous appointment entry, it will save the last signature. A previously saved signature would then change to whatever signature was last copied.

 

My question is two parts:

1. Is there a simpler method to accomplish the above steps? Could I combine some of these into one step instead of two or three?

2. Is there a way to set the field using If(IsBlank) for instance so the form field only saves the last copied signature if the field is blank?

 

Thanks in advance for your help. The community here has always been fantastic.

1 ACCEPTED SOLUTION

Accepted Solutions

@loepan ,

To add an option, I do something similar - I have a pop-up signature box with the pen input and a save button.

The button does this

UpdateContext(
   {
      varSigned:true,
      varShowSig:false
   }
)

the second bit then hides the box

On the Update of the card with the JSON text field

If(
   varSigned,
   Substitute(
      JSON(
         Sig.Image, 
         IncludeBinaryData
      ),
      Char(34),
      ""
   ),
   Parent.Default
)

so if there is no signature, it simply shows the current value for the record. 

I also do the full conversion here, so the image displayed is simply the content of the JSON text.

You also need to clean up varSigned to false on save and screen exit code.

 

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

6 REPLIES 6
Resolver I
Resolver I

Try this,

1. Assign a variable at submit button

Set(resetvar, false);

Set(resetvar,true);

 

This will make variable change from low to high.

2. Assign this variable for Reset function of peninput control.

 

 

So whenever you press submit button variables change from low to high which resets the pen input

Hey Jagadeeshk, Thanks for the prompt response. This doesn't address the issue I'm having. There are several steps that need to take place and it's the last step that's causing the problem.

 

  1. A signature is made
  2. The signature is converted to binary
  3. The binary is saved to a text field where it's cleaned up so the image control can read it and display as an image

What I need to do next is get the modified text into the EditForm Data Card to be saved to SharePoint. If I set the DataCard Default to the text field with the data, it will always show the last data copied. This works well unless you start reviewing other appointments. Then the last saved data will always appear in this box for any appointment reviewed. Once saved, the wrong signature will be saved and show for the wrong entry. You could then essentially accidentally copy one signature to multiple appointments.

The same logic u can apply to datacard aswell to reset the old data once submit the form.

 

May be you explain little more if my understanding is something 

@loepan ,

To add an option, I do something similar - I have a pop-up signature box with the pen input and a save button.

The button does this

UpdateContext(
   {
      varSigned:true,
      varShowSig:false
   }
)

the second bit then hides the box

On the Update of the card with the JSON text field

If(
   varSigned,
   Substitute(
      JSON(
         Sig.Image, 
         IncludeBinaryData
      ),
      Char(34),
      ""
   ),
   Parent.Default
)

so if there is no signature, it simply shows the current value for the record. 

I also do the full conversion here, so the image displayed is simply the content of the JSON text.

You also need to clean up varSigned to false on save and screen exit code.

 

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

Hey Warren,

 

Many thanks. Using your example, I made the following changes and it seems to function as intended. Do you see any issues with this approach?

 

Check-in screen shows the Pen Input with a Save Button On Select:

 

Set(varSig, JSON(Sig.Image, IncludeBinaryData));Set(VarSigned, true)

 

The Data Card Update:

 

If(VarSigned,Substitute(varSig,Char(34),""),ThisItem.Image)

 

The submit button On Select:

 

SubmitForm(EditForm2);Reset(Sig); Navigate(DetailScreen1, ScreenTransition.None);Set(VarSigned,false)

 

 

Thanks @loepan ,

Pretty much the same expect you have shifted the conversion to useful Base64 text to the Update instead of the Variable.

Both approaches produce identical results back in the Text field.

ThisItem.FieldName and Parent.Default are fundamentally the same. 

It all should work for you.

Helpful resources

Announcements
New Badges

New Solution Badges!

Check out our new profile badges recognizing authored solutions!

New Power Super Users

Congratulations!

We are excited to announce the Power Apps Super Users!

Power Apps Community Call

Power Apps Community Call: February

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

Microsoft Ignite

Microsoft Ignite

Join digitally, March 2–4, 2021 to explore new tech that's ready to implement. Experience the keynote in mixed reality through AltspaceVR!

Top Solution Authors
Top Kudoed Authors
Users online (101,002)