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

Help needed with resetting values

Hi Guys, I have build an app for a customer but can't figure out how to reset a link. 

 

So basically you take a picture and press "Kies Foto". The first time when I start the app this works but I want to have the opportunity to make multiple pictures. So I added a reset button but I can't manage to reset the value of "Kies foto".

 

When you press "Kies Foto" it does this : Set(Attachment; JSON(UploadedImage2.Image; JSONFormat.IncludeBinaryData));;
Set(VarBase64Only; Mid(Attachment; Find(","; Attachment)+1; Len(Attachment) - Find(","; Attachment) -1 ) );; 

 

I want to clear the varbase64only or attachment when pressing the reset button and want to make the buttons/labels below visible only if attachement and varbase64only have been set. I haven't managed to get this to work and have searched for hours for the solution.

aas.PNGdsadasdaadas.PNGreset.PNG

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
WarrenBelz
Super User III
Super User III

Hi @afs_admin ,

Firstly you have not included the step you use to get the UploadedImage2.Image and you have mentioned taking a picture. So are you using the camera control or taking a picture on the device and uploading this using the Add Picture control.

Assuming you are dong the second one, this code

Set(
   Attachment; 
   JSON(
      UploadedImage2.Image; 
      JSONFormat.IncludeBinaryData
   )
);;
Set(
   VarBase64Only; 
   Mid(
      Attachment; 
         Find(
         ","; 
         Attachment
      )+1; 
      Len(Attachment) - 
      Find(
         ","; 
         Attachment
      ) -1 
   )
);; 

Stores your Base64 string from the picture in a Variable called VarBase64Only
Now you want to clear the varbase64only or attachment when pressing the reset button and want to make the buttons/labels below visible only if attachement and varbase64only have been set.
Firstly, I would rename the Variable Attachment to something else as this could lead to some ambiguity in some code.
Other than that,  two bits here.

Set(Attachment,Blank());;
Set(VarBase64Only,Blank())

and on the Visible of the controls you want hidden

!IsBlank(VarBase64Only)

 

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

2 REPLIES 2
WarrenBelz
Super User III
Super User III

Hi @afs_admin ,

Firstly you have not included the step you use to get the UploadedImage2.Image and you have mentioned taking a picture. So are you using the camera control or taking a picture on the device and uploading this using the Add Picture control.

Assuming you are dong the second one, this code

Set(
   Attachment; 
   JSON(
      UploadedImage2.Image; 
      JSONFormat.IncludeBinaryData
   )
);;
Set(
   VarBase64Only; 
   Mid(
      Attachment; 
         Find(
         ","; 
         Attachment
      )+1; 
      Len(Attachment) - 
      Find(
         ","; 
         Attachment
      ) -1 
   )
);; 

Stores your Base64 string from the picture in a Variable called VarBase64Only
Now you want to clear the varbase64only or attachment when pressing the reset button and want to make the buttons/labels below visible only if attachement and varbase64only have been set.
Firstly, I would rename the Variable Attachment to something else as this could lead to some ambiguity in some code.
Other than that,  two bits here.

Set(Attachment,Blank());;
Set(VarBase64Only,Blank())

and on the Visible of the controls you want hidden

!IsBlank(VarBase64Only)

 

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

@WarrenBelz  You're a lifesaver! 

 

Thanks for the great solution. I needed to change some symbols, we use ; instead of , and & instead of ; but overall it works now!

 

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

secondImage

Demo Extravaganza is Back!

We are excited to announce that Demo Extravaganza for 2021 has started!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Power Apps June 2021

June Power Apps Community Call

Don't miss the call this month on June 16th - 8a PDT

Top Solution Authors
Top Kudoed Authors
Users online (71,424)