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

Reset GUID at APP Close

I am creating a 3 screen app.

I have set ONSTART changed to ClearCollect( NewGUID, ForAll( [ 1 ], GUID() ) )

   from  set( NewGUID, GUID() ) )

In the first screen OnVisible property, a collection:

                     ClearCollect(collect1, {username : User().FullName, sessionid : NewGUID, creationdate : Now()} )

Here I have a Login button. OnSelect property is 

                     Patch('[dbo].[GRV_Details]',collect1)

 

The patch is giving me error : "Invalid Argument Type (table).

 

The collection of GUID is causing an issue. It is working fine with global variable. The database is updated at Login button.

Secondly, the GUID must get resetted at database update. How to achieve that? I thought in clearcollect will work and I will be able to clear the entry in collection to reset GUID value.

 

Regards,

Naresh R

 

1 REPLY 1
Highlighted
Microsoft Paul_C
Microsoft

Re: Reset GUID at APP Close

Hi Naresh,

 

collect1 actually is a table (although it only has one entry), which is probably why you're getting the error. To get the first entry from the collection, you can do: First(collect1)

 

Also note that the collection collect1 is only local to your app and distinct from the data source -- it will not affect the data source implicitly. So clearing the collection will have no effect on the data source, for instance. To change the data source you will need to do so explicitly using functions like Patch() or other functions that allow you to manipulate data sources.

 

Here are some docs for some of these data source functions, if you want to read more:

https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/functions/function-remove-removeif

https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/functions/function-patch

https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/functions/function-update-updateif

 

- Paul C.
Software Engineer on PowerApps

Helpful resources

Announcements
Better Together’ Contest Finalists Announced!

'Better Together’ Contest Finalists Announced!

Congrats to the finalists of our ‘Better Together’-themed T-shirt design contest! Click for the top entries.

thirdimage

Power Apps Community User Group Member Badge

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

sixthImage

Join THE global Microsoft Power Platform event series

Attend for two days of expert-led learning and innovation on topics like AI and Analytics, powered by Dynamic Communities

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

thirdimage

Microsoft Business Applications Virtual Launch

Join us for the Microsoft Business Applications Virtual Launch Event on Thursday, April 2, 2020, at 8:00 AM PST.

thirdimage

Community Summit North America

Innovate, Collaborate, Grow - The top training and networking event across the globe for Microsoft Business Applications

Top Solution Authors
Top Kudoed Authors
Users online (5,333)