cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
CaiChicken
Advocate I
Advocate I

How to reset a GUID() ?

Hello Friend,

 

I'm using GUID() inside my app but I haven't find a method to generate a new GUID,

 

I tried write GUID() inside a TextInput Default and reset() the TextInput with no luck, any ideas?

 

Best,

1 ACCEPTED SOLUTION

Accepted Solutions
v-bofeng-msft
Community Support
Community Support

Hi @CaiChicken :

Firstly,let me explain why you encounted this problem.

The point is GUID is a volatile function when used without an argument.For example, a label control for which the Text property is set to GUID() won't change while your app is active. Only closing and reopening the app will result in a different value.

Secondly,please try this solution:

The point is to store the value of GUID in a variable.

1\set the apps's OnStart property to:

 

Set(varvar,GUID()); /*varvar is my custom variable*/

 

2\add a textinput control(TextInput4😞

Default:

 

varvar

 

3\Add a button:

OnSelect:

 

Set(varvar,GUID());Reset(TextInput4)

 

2.gif

Best Regards,

Bof

 

 

View solution in original post

2 REPLIES 2
v-bofeng-msft
Community Support
Community Support

Hi @CaiChicken :

Firstly,let me explain why you encounted this problem.

The point is GUID is a volatile function when used without an argument.For example, a label control for which the Text property is set to GUID() won't change while your app is active. Only closing and reopening the app will result in a different value.

Secondly,please try this solution:

The point is to store the value of GUID in a variable.

1\set the apps's OnStart property to:

 

Set(varvar,GUID()); /*varvar is my custom variable*/

 

2\add a textinput control(TextInput4😞

Default:

 

varvar

 

3\Add a button:

OnSelect:

 

Set(varvar,GUID());Reset(TextInput4)

 

2.gif

Best Regards,

Bof

 

 

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.

Microsoft Build 768x460.png

Microsoft Build is May 24-26. Have you registered yet?

Come together to explore latest innovations in code and application development—and gain insights from experts from around the world.

Top Solution Authors
Top Kudoed Authors
Users online (2,072)